[kune-commits] r840 - in trunk: .
src/main/java/org/ourproject/kune/chat/client
src/main/java/org/ourproject/kune/chat/client/ctx/rooms
src/main/java/org/ourproject/kune/docs/client
src/main/java/org/ourproject/kune/docs/client/cnt
src/main/java/org/ourproject/kune/docs/client/ctx/admin
src/main/java/org/ourproject/kune/docs/client/ctx/folder
src/main/java/org/ourproject/kune/platf/client
src/main/java/org/ourproject/kune/platf/client/app
src/main/java/org/ourproject/kune/platf/client/dto
src/main/java/org/ourproject/kune/platf/client/rpc
src/main/java/org/ourproject/kune/platf/client/services
src/main/java/org/ourproject/kune/platf/client/state
src/main/java/org/ourproject/kune/platf/server/manager/impl
src/main/java/org/ourproject/kune/workspace/client/ui/ctx/items
src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/siteusermenu
src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/title
src/test/java/org/ourproject/kune/platf/client
src/test/java/org/ourproject/kune/platf/server
src/test/java/org/ourproject/kune/platf/server/mapper
src/test/java/org/ourproject/kune/sitebar/client
src/test/java/org/ourproject/kune/workspace/client
src/test/java/org/ourproject/kune/workspace/client/sitebar
src/test/java/org/ourproject/kune/workspace/client/sitebar/msg
vjrj
vjrj at ourproject.org
Sun Aug 10 06:29:51 CEST 2008
Author: vjrj
Date: 2008-08-10 06:29:30 +0200 (Sun, 10 Aug 2008)
New Revision: 840
Added:
trunk/src/test/java/org/ourproject/kune/workspace/client/sitebar/
trunk/src/test/java/org/ourproject/kune/workspace/client/sitebar/msg/
trunk/src/test/java/org/ourproject/kune/workspace/client/sitebar/msg/SiteMessagePresenterTest.java
Removed:
trunk/src/main/java/org/ourproject/kune/chat/client/actions/
trunk/src/main/java/org/ourproject/kune/docs/client/DocsClientModule.java
trunk/src/main/java/org/ourproject/kune/docs/client/actions/
trunk/src/main/java/org/ourproject/kune/docs/client/ui/
trunk/src/main/java/org/ourproject/kune/platf/client/KunePlatform.java
trunk/src/main/java/org/ourproject/kune/platf/client/PlatformEvents.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/
trunk/src/main/java/org/ourproject/kune/platf/client/dispatch/
trunk/src/main/java/org/ourproject/kune/platf/client/dto/SaveDocumentActionParams.java
trunk/src/main/java/org/ourproject/kune/platf/client/extend/
trunk/src/test/java/org/ourproject/kune/platf/client/dispatch/
trunk/src/test/java/org/ourproject/kune/platf/server/init/
trunk/src/test/java/org/ourproject/kune/platf/server/services/
trunk/src/test/java/org/ourproject/kune/sitebar/client/msg/
trunk/src/test/java/org/ourproject/kune/sitebar/client/ui/
trunk/src/test/java/org/ourproject/kune/workspace/client/actions/
Modified:
trunk/pom.xml
trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientNewModule.java
trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientTool.java
trunk/src/main/java/org/ourproject/kune/chat/client/ctx/rooms/RoomsAdminPresenter.java
trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientNewModule.java
trunk/src/main/java/org/ourproject/kune/docs/client/cnt/DocumentContentPresenter.java
trunk/src/main/java/org/ourproject/kune/docs/client/ctx/admin/AdminContextPresenter.java
trunk/src/main/java/org/ourproject/kune/docs/client/ctx/folder/FolderContextPresenter.java
trunk/src/main/java/org/ourproject/kune/platf/client/app/Application.java
trunk/src/main/java/org/ourproject/kune/platf/client/app/ApplicationDefault.java
trunk/src/main/java/org/ourproject/kune/platf/client/rpc/ContentService.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/state/Session.java
trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/SocialNetworkManagerDefault.java
trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/items/ContextItems.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/ContextItemsView.java
trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/siteusermenu/SiteUserMenuPanel.java
trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/siteusermenu/SiteUserMenuPresenter.java
trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/title/EntityTitlePresenter.java
trunk/src/test/java/org/ourproject/kune/platf/server/mapper/MapperTest.java
Log:
Dispacher removed
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2008-08-09 18:40:32 UTC (rev 839)
+++ trunk/pom.xml 2008-08-10 04:29:30 UTC (rev 840)
@@ -425,12 +425,6 @@
<includes>
<include>**/Kune-Platform.gwt.xml**</include>
<include>**/I18nTranslationService**</include>
- <include>**/Plugin.**</include>
- <include>**/PluginManager.**</include>
- <include>**/dispatch/**</include>
- <include>**/Extensi*</include>
- <include>**/PlatformEvents.**</include>
- <include>**/BottomTrayIcon.**</include>
<include>**/BasicDialog.**</include>
<include>**/HorizontalLine.**</include>
<include>**/AbstractLabel.**</include>
@@ -441,11 +435,8 @@
<include>**/IconHyperlink*.**</include>
<include>**/LabelWrapper*.**</include>
<include>**/KuneUiUtils.**</include>
- <include>**/RoundedBorderDecorator.**</include>
- <include>**/HasColor.**</include>
<include>**/View.**</include>
<!-- <include>**/platf/**</include>
- <include>**/AbstractPresenter**</include>
<include>**/platf/client/extend/**</include>
<include>**/platf/client/*java</include>
<include>**/platf/client/app/**</include>
Modified: trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientNewModule.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientNewModule.java 2008-08-09 18:40:32 UTC (rev 839)
+++ trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientNewModule.java 2008-08-10 04:29:30 UTC (rev 840)
@@ -14,7 +14,6 @@
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.KunePlatform;
import org.ourproject.kune.platf.client.app.Application;
import org.ourproject.kune.platf.client.rpc.ContentServiceAsync;
import org.ourproject.kune.platf.client.state.Session;
@@ -97,7 +96,7 @@
}
});
- final ChatClientTool chatClientTool = $(ChatClientTool.class);
- $(KunePlatform.class).addTool(chatClientTool);
+ $(ChatClientTool.class);
+
}
}
Modified: trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientTool.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientTool.java 2008-08-09 18:40:32 UTC (rev 839)
+++ trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientTool.java 2008-08-10 04:29:30 UTC (rev 840)
@@ -32,10 +32,12 @@
import org.ourproject.kune.platf.client.tool.AbstractClientTool;
import org.ourproject.kune.platf.client.tool.ToolSelector;
import org.ourproject.kune.platf.client.ui.MenuItem;
+import org.ourproject.kune.platf.client.ui.WindowUtils;
import org.ourproject.kune.workspace.client.socialnet.GroupMembersSummary;
import org.ourproject.kune.workspace.client.ui.newtmp.skel.WorkspaceSkeleton;
import org.ourproject.kune.workspace.client.ui.newtmp.themes.WsThemePresenter;
+import com.allen_sauer.gwt.log.client.Log;
import com.calclab.emite.client.xmpp.stanzas.XmppURI;
import com.calclab.emiteuimodule.client.EmiteUIDialog;
import com.calclab.suco.client.container.Provider;
@@ -61,6 +63,7 @@
this.chatContextProvider = chatContextProvider;
session.onInitDataReceived(new Slot<InitDataDTO>() {
public void onEvent(final InitDataDTO initData) {
+ checkChatDomain(initData.getChatDomain());
final ChatOptions chatOptions = new ChatOptions(initData.getChatHttpBase(), initData.getChatDomain(),
initData.getChatRoomHost());
chat = new ChatEngineXmpp(emiteUIDialog, chatOptions, i18n, ws);
@@ -79,6 +82,15 @@
}
}), true);
}
+
+ private void checkChatDomain(final String chatDomain) {
+ final String httpDomain = WindowUtils.getLocation().getHostName();
+ if (!chatDomain.equals(httpDomain)) {
+ Log.error("Your http domain (" + httpDomain + ") is different from the chat domain (" + chatDomain
+ + "). This will produce problems with the chat functionality. "
+ + "Check kune.properties on the server.");
+ }
+ }
});
application.onApplicationStop(new Slot0() {
public void onEvent() {
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-08-09 18:40:32 UTC (rev 839)
+++ trunk/src/main/java/org/ourproject/kune/chat/client/ctx/rooms/RoomsAdminPresenter.java 2008-08-10 04:29:30 UTC (rev 840)
@@ -49,7 +49,7 @@
contextItems.setParentTreeVisible(false);
contextItems.registerType(ChatClientTool.TYPE_CHAT, images.page());
contextItems.registerType(ChatClientTool.TYPE_ROOM, images.chatGreen());
- contextItems.canCreate(ChatClientTool.TYPE_ROOM, i18n.t("New chat room"), new Slot<String>() {
+ contextItems.canCreate(i18n.t("New chat room"), i18n.t("Add a chat room"), new Slot<String>() {
public void onEvent(final String name) {
Site.showProgressProcessing();
final String groupShortName = session.getCurrentState().getGroup().getShortName();
Deleted: trunk/src/main/java/org/ourproject/kune/docs/client/DocsClientModule.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/DocsClientModule.java 2008-08-09 18:40:32 UTC (rev 839)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/DocsClientModule.java 2008-08-10 04:29:30 UTC (rev 840)
@@ -1,66 +0,0 @@
-/*
- *
- * Copyright (C) 2007-2008 The kune development team (see CREDITS for details)
- * This file is part of kune.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-package org.ourproject.kune.docs.client;
-
-import org.ourproject.kune.docs.client.actions.AddDocumentAction;
-import org.ourproject.kune.docs.client.actions.AddFolderAction;
-import org.ourproject.kune.docs.client.actions.ContentAddAuthorAction;
-import org.ourproject.kune.docs.client.actions.ContentDelContentAction;
-import org.ourproject.kune.docs.client.actions.ContentRemoveAuthorAction;
-import org.ourproject.kune.docs.client.actions.ContentRenameAction;
-import org.ourproject.kune.docs.client.actions.ContentSetLanguageAction;
-import org.ourproject.kune.docs.client.actions.ContentSetPublishedOnAction;
-import org.ourproject.kune.docs.client.actions.DocsEvents;
-import org.ourproject.kune.docs.client.actions.GoParentFolderAction;
-import org.ourproject.kune.docs.client.actions.RenameTokenAction;
-import org.ourproject.kune.docs.client.actions.SaveDocumentAction;
-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;
-
-public class DocsClientModule implements ClientModule {
-
- private final Session session;
- private final StateManager stateManager;
- private final I18nTranslationService i18n;
-
- public DocsClientModule(final Session session, final StateManager stateManager, final I18nTranslationService i18n) {
- this.session = session;
- this.stateManager = stateManager;
- this.i18n = i18n;
- }
-
- public void configure(final Register register) {
- 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));
- register.addAction(DocsEvents.SET_LANGUAGE, new ContentSetLanguageAction(session));
- register.addAction(DocsEvents.SET_PUBLISHED_ON, new ContentSetPublishedOnAction(session));
- register.addAction(DocsEvents.RENAME_CONTENT, new ContentRenameAction(session));
- register.addAction(DocsEvents.DEL_CONTENT, new ContentDelContentAction(stateManager, session));
- register.addAction(DocsEvents.RENAME_TOKEN, new RenameTokenAction(session, stateManager));
- }
-}
Modified: trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientNewModule.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientNewModule.java 2008-08-09 18:40:32 UTC (rev 839)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientNewModule.java 2008-08-10 04:29:30 UTC (rev 840)
@@ -25,7 +25,8 @@
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.KunePlatform;
+import org.ourproject.kune.platf.client.rpc.ContentServiceAsync;
+import org.ourproject.kune.platf.client.services.KuneErrorHandler;
import org.ourproject.kune.platf.client.state.Session;
import org.ourproject.kune.platf.client.state.StateManager;
import org.ourproject.kune.platf.client.tool.ToolSelector;
@@ -37,6 +38,8 @@
import org.ourproject.kune.workspace.client.ui.ctx.items.ContextItems;
import org.ourproject.kune.workspace.client.ui.newtmp.skel.WorkspaceSkeleton;
import org.ourproject.kune.workspace.client.ui.newtmp.themes.WsThemePresenter;
+import org.ourproject.kune.workspace.client.ui.newtmp.title.EntitySubTitlePresenter;
+import org.ourproject.kune.workspace.client.ui.newtmp.title.EntityTitlePresenter;
import com.calclab.suco.client.modules.AbstractModule;
import com.calclab.suco.client.provider.Factory;
@@ -62,7 +65,8 @@
register(SingletonScope.class, new Factory<AdminContext>(AdminContext.class) {
public AdminContext create() {
final AdminContextPresenter presenter = new AdminContextPresenter($(Session.class),
- $$(TagsSummary.class));
+ $(StateManager.class), $$(TagsSummary.class), $$(ContentServiceAsync.class),
+ $(EntityTitlePresenter.class), $(EntitySubTitlePresenter.class));
final AdminContextView view = new AdminContextPanel(presenter, i18n);
presenter.init(view);
return presenter;
@@ -72,9 +76,11 @@
register(SingletonScope.class, new Factory<DocumentContent>(DocumentContent.class) {
public DocumentContent create() {
final WorkspaceDeckPanel panel = new WorkspaceDeckPanel();
- final DocumentContentPresenter presenter = new DocumentContentPresenter(panel, $(Session.class),
+ final DocumentContentPresenter presenter = new DocumentContentPresenter($(StateManager.class),
+ $(I18nUITranslationService.class), $(KuneErrorHandler.class), panel, $(Session.class),
$(RateIt.class), $$(DocumentReader.class), $$(DocumentReaderControl.class),
- $$(TextEditor.class), $$(FolderViewer.class), $$(FolderEditor.class));
+ $$(TextEditor.class), $$(FolderViewer.class), $$(FolderEditor.class),
+ $$(ContentServiceAsync.class));
return presenter;
}
});
@@ -106,7 +112,8 @@
register(SingletonScope.class, new Factory<FolderContext>(FolderContext.class) {
public FolderContext create() {
- final FolderContextPresenter presenter = new FolderContextPresenter($(ContextItems.class), i18n);
+ final FolderContextPresenter presenter = new FolderContextPresenter($(ContextItems.class),
+ $(StateManager.class), $(Session.class), i18n, $$(ContentServiceAsync.class));
return presenter;
}
});
@@ -127,13 +134,6 @@
}
});
- final KunePlatform platform = $(KunePlatform.class);
- final DocumentClientTool docClientTool = $(DocumentClientTool.class);
- platform.addTool(docClientTool);
-
- final Session session = $(Session.class);
- final StateManager stateManager = $(StateManager.class);
- platform.install(new DocsClientModule(session, stateManager, i18n));
+ $(DocumentClientTool.class);
}
-
}
Modified: trunk/src/main/java/org/ourproject/kune/docs/client/cnt/DocumentContentPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/cnt/DocumentContentPresenter.java 2008-08-09 18:40:32 UTC (rev 839)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/cnt/DocumentContentPresenter.java 2008-08-10 04:29:30 UTC (rev 840)
@@ -20,28 +20,33 @@
package org.ourproject.kune.docs.client.cnt;
-import org.ourproject.kune.docs.client.actions.DocsEvents;
import org.ourproject.kune.docs.client.cnt.folder.FolderEditor;
import org.ourproject.kune.docs.client.cnt.folder.viewer.FolderViewer;
import org.ourproject.kune.docs.client.cnt.reader.DocumentReader;
import org.ourproject.kune.docs.client.cnt.reader.DocumentReaderControl;
import org.ourproject.kune.platf.client.View;
-import org.ourproject.kune.platf.client.dispatch.DefaultDispatcher;
-import org.ourproject.kune.platf.client.dto.SaveDocumentActionParams;
import org.ourproject.kune.platf.client.dto.StateDTO;
+import org.ourproject.kune.platf.client.errors.SessionExpiredException;
import org.ourproject.kune.platf.client.rpc.AsyncCallbackSimple;
+import org.ourproject.kune.platf.client.rpc.ContentServiceAsync;
+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.ui.rate.RateIt;
import org.ourproject.kune.workspace.client.component.WorkspaceDeckView;
import org.ourproject.kune.workspace.client.editor.TextEditor;
import org.ourproject.kune.workspace.client.editor.TextEditorListener;
+import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService;
+import org.ourproject.kune.workspace.client.sitebar.Site;
import com.calclab.suco.client.container.Provider;
import com.calclab.suco.client.signal.Signal0;
import com.calclab.suco.client.signal.Slot0;
+import com.google.gwt.user.client.rpc.AsyncCallback;
public class DocumentContentPresenter implements DocumentContent, TextEditorListener {
private final WorkspaceDeckView view;
+ private final StateManager stateManager;
private StateDTO content;
private final Session session;
private final RateIt rateIt;
@@ -52,12 +57,20 @@
private final Provider<FolderViewer> folderViewerProvider;
private final Signal0 onEdit;
private final Signal0 onCancel;
+ private final Provider<ContentServiceAsync> contentServiceProvider;
+ private final I18nUITranslationService i18n;
+ private final KuneErrorHandler errorHandler;
- public DocumentContentPresenter(final WorkspaceDeckView view, final Session session, final RateIt rateIt,
- final Provider<DocumentReader> docReaderProvider,
+ public DocumentContentPresenter(final StateManager stateManager, final I18nUITranslationService i18n,
+ final KuneErrorHandler errorHandler, final WorkspaceDeckView view, final Session session,
+ final RateIt rateIt, final Provider<DocumentReader> docReaderProvider,
final Provider<DocumentReaderControl> docReaderControlProvider,
final Provider<TextEditor> textEditorProvider, final Provider<FolderViewer> folderViewerProvider,
- final Provider<FolderEditor> folderEditorProvider) {
+ final Provider<FolderEditor> folderEditorProvider,
+ final Provider<ContentServiceAsync> contentServiceProvider) {
+ this.stateManager = stateManager;
+ this.i18n = i18n;
+ this.errorHandler = errorHandler;
this.view = view;
this.session = session;
this.rateIt = rateIt;
@@ -66,6 +79,7 @@
this.textEditorProvider = textEditorProvider;
this.folderViewerProvider = folderViewerProvider;
this.folderEditorProvider = folderEditorProvider;
+ this.contentServiceProvider = contentServiceProvider;
this.onEdit = new Signal0("onEdit");
this.onCancel = new Signal0("onCancel");
}
@@ -86,7 +100,15 @@
}
public void onDelete() {
- DefaultDispatcher.getInstance().fire(DocsEvents.DEL_CONTENT, content.getDocumentId());
+ Site.showProgressProcessing();
+ contentServiceProvider.get().delContent(session.getUserHash(),
+ session.getCurrentState().getGroup().getShortName(), content.getDocumentId(),
+ new AsyncCallbackSimple<Object>() {
+ public void onSuccess(final Object result) {
+ Site.hideProgress();
+ stateManager.reload();
+ }
+ });
}
public void onEdit() {
@@ -114,9 +136,27 @@
public void onSave(final String text) {
content.setContent(text);
- DefaultDispatcher.getInstance().fire(DocsEvents.SAVE_DOCUMENT, new SaveDocumentActionParams(content, this));
- // Re-enable rateIt widget
- rateIt.setVisible(true);
+ Site.showProgressSaving();
+ contentServiceProvider.get().save(session.getUserHash(), session.getCurrentState().getGroup().getShortName(),
+ content.getDocumentId(), content.getContent(), new AsyncCallback<Integer>() {
+ public void onFailure(final Throwable caught) {
+ Site.hideProgress();
+ try {
+ throw caught;
+ } catch (final SessionExpiredException e) {
+ errorHandler.doSessionExpired();
+ } catch (final Throwable e) {
+ Site.error(i18n.t("Error saving document. Retrying..."));
+ errorHandler.process(caught);
+ onSaveFailed();
+ }
+ }
+
+ public void onSuccess(final Integer result) {
+ Site.hideProgress();
+ onSaved();
+ }
+ });
}
public void onSaved() {
Modified: trunk/src/main/java/org/ourproject/kune/docs/client/ctx/admin/AdminContextPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/ctx/admin/AdminContextPresenter.java 2008-08-09 18:40:32 UTC (rev 839)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/ctx/admin/AdminContextPresenter.java 2008-08-10 04:29:30 UTC (rev 840)
@@ -23,20 +23,20 @@
import java.util.Date;
import java.util.List;
-import org.ourproject.kune.docs.client.actions.DocsEvents;
import org.ourproject.kune.platf.client.View;
-import org.ourproject.kune.platf.client.dispatch.DefaultDispatcher;
import org.ourproject.kune.platf.client.dto.AccessListsDTO;
import org.ourproject.kune.platf.client.dto.I18nLanguageDTO;
import org.ourproject.kune.platf.client.dto.StateDTO;
import org.ourproject.kune.platf.client.dto.TagResultDTO;
import org.ourproject.kune.platf.client.dto.UserSimpleDTO;
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.state.Session;
+import org.ourproject.kune.platf.client.state.StateManager;
import org.ourproject.kune.workspace.client.sitebar.Site;
import org.ourproject.kune.workspace.client.tags.TagsSummary;
+import org.ourproject.kune.workspace.client.ui.newtmp.title.EntitySubTitlePresenter;
+import org.ourproject.kune.workspace.client.ui.newtmp.title.EntityTitlePresenter;
import com.calclab.suco.client.container.Provider;
@@ -45,14 +45,57 @@
private AdminContextView view;
private final Session session;
private final Provider<TagsSummary> tagsSummaryProvider;
+ private final Provider<ContentServiceAsync> contentServiceProvider;
+ private final EntitySubTitlePresenter entitySubTitlePresenter;
+ private final EntityTitlePresenter entityTitlePresenter;
+ private final StateManager stateManager;
- public AdminContextPresenter(final Session session, final Provider<TagsSummary> tagsSummaryProvider) {
+ public AdminContextPresenter(final Session session, final StateManager stateManager,
+ final Provider<TagsSummary> tagsSummaryProvider,
+ final Provider<ContentServiceAsync> contentServiceProvider,
+ final EntityTitlePresenter entityTitlePresenter, final EntitySubTitlePresenter entitySubTitlePresenter) {
this.session = session;
+ this.stateManager = stateManager;
this.tagsSummaryProvider = tagsSummaryProvider;
+ this.contentServiceProvider = contentServiceProvider;
+ this.entityTitlePresenter = entityTitlePresenter;
+ this.entitySubTitlePresenter = entitySubTitlePresenter;
}
+ public void addAuthor(final String authorShortName) {
+ Site.showProgressProcessing();
+ final StateDTO currentState = session.getCurrentState();
+ contentServiceProvider.get().addAuthor(session.getUserHash(), currentState.getGroup().getShortName(),
+ currentState.getDocumentId(), authorShortName, new AsyncCallbackSimple<Object>() {
+ public void onSuccess(final Object result) {
+ Site.hideProgress();
+ stateManager.reload();
+ }
+ });
+ }
+
+ public void delAuthor(final String authorShortName) {
+ Site.showProgressProcessing();
+ final StateDTO currentState = session.getCurrentState();
+ contentServiceProvider.get().removeAuthor(session.getUserHash(), currentState.getGroup().getShortName(),
+ currentState.getDocumentId(), authorShortName, new AsyncCallbackSimple<Object>() {
+ public void onSuccess(final Object result) {
+ Site.hideProgress();
+ stateManager.reload();
+ }
+ });
+ }
+
public void doChangeLanguage(final String langCode) {
- DefaultDispatcher.getInstance().fire(DocsEvents.SET_LANGUAGE, langCode);
+ Site.showProgressProcessing();
+ final StateDTO currentState = session.getCurrentState();
+ contentServiceProvider.get().setLanguage(session.getUserHash(), currentState.getGroup().getShortName(),
+ currentState.getDocumentId(), langCode, new AsyncCallbackSimple<I18nLanguageDTO>() {
+ public void onSuccess(final I18nLanguageDTO lang) {
+ Site.hideProgress();
+ entitySubTitlePresenter.setContentLanguage(lang.getEnglishName());
+ }
+ });
}
public View getView() {
@@ -63,8 +106,17 @@
this.view = view;
}
- public void setPublishedOn(final Date date) {
- DefaultDispatcher.getInstance().fire(DocsEvents.SET_PUBLISHED_ON, date);
+ public void setPublishedOn(final Date publishedOn) {
+ Site.showProgressProcessing();
+ final StateDTO currentState = session.getCurrentState();
+ contentServiceProvider.get().setPublishedOn(session.getUserHash(), currentState.getGroup().getShortName(),
+ currentState.getDocumentId(), publishedOn, new AsyncCallbackSimple<Object>() {
+ public void onSuccess(final Object result) {
+ Site.hideProgress();
+ entityTitlePresenter.setContentDate(publishedOn);
+ }
+ });
+
}
public void setState(final StateDTO content) {
@@ -106,10 +158,9 @@
public void setTags(final String tagsString) {
Site.showProgressProcessing();
- final ContentServiceAsync server = ContentService.App.getInstance();
final StateDTO currentState = session.getCurrentState();
- server.setTags(session.getUserHash(), currentState.getGroup().getShortName(), currentState.getDocumentId(),
- tagsString, new AsyncCallbackSimple<List<TagResultDTO>>() {
+ contentServiceProvider.get().setTags(session.getUserHash(), currentState.getGroup().getShortName(),
+ currentState.getDocumentId(), tagsString, new AsyncCallbackSimple<List<TagResultDTO>>() {
public void onSuccess(final List<TagResultDTO> result) {
tagsSummaryProvider.get().setGroupTags(result);
Site.hideProgress();
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-08-09 18:40:32 UTC (rev 839)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/ctx/folder/FolderContextPresenter.java 2008-08-10 04:29:30 UTC (rev 840)
@@ -21,34 +21,72 @@
package org.ourproject.kune.docs.client.ctx.folder;
import org.ourproject.kune.docs.client.DocumentClientTool;
-import org.ourproject.kune.docs.client.actions.DocsEvents;
import org.ourproject.kune.platf.client.View;
import org.ourproject.kune.platf.client.dto.AccessRightsDTO;
import org.ourproject.kune.platf.client.dto.ContainerDTO;
+import org.ourproject.kune.platf.client.dto.StateDTO;
import org.ourproject.kune.platf.client.dto.StateToken;
+import org.ourproject.kune.platf.client.rpc.AsyncCallbackSimple;
+import org.ourproject.kune.platf.client.rpc.ContentServiceAsync;
import org.ourproject.kune.platf.client.services.I18nTranslationService;
+import org.ourproject.kune.platf.client.state.Session;
+import org.ourproject.kune.platf.client.state.StateManager;
+import org.ourproject.kune.workspace.client.sitebar.Site;
import org.ourproject.kune.workspace.client.ui.ctx.items.ContextItems;
import org.ourproject.kune.workspace.client.ui.ctx.items.ContextItemsImages;
+import com.calclab.suco.client.container.Provider;
+import com.calclab.suco.client.signal.Slot;
+
public class FolderContextPresenter implements FolderContext {
private 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, i18n.t("New document"), DocsEvents.ADD_DOCUMENT);
- contextItems.canCreate(DocumentClientTool.TYPE_FOLDER, i18n.t("New folder"), DocsEvents.ADD_FOLDER);
- contextItems.setParentTreeVisible(true);
+ public FolderContextPresenter(final ContextItems contextItems, final StateManager stateManager,
+ final Session session, final I18nTranslationService i18n,
+ final Provider<ContentServiceAsync> contentServiceProvider) {
+ this.contextItems = contextItems;
+ final ContextItemsImages contextImages = ContextItemsImages.App.getInstance();
+ contextItems.registerType(DocumentClientTool.TYPE_DOCUMENT, contextImages.pageWhite());
+ contextItems.registerType(DocumentClientTool.TYPE_FOLDER, contextImages.folder());
+ contextItems.canCreate(i18n.t("New document"), i18n.t("Add a document"), new Slot<String>() {
+ public void onEvent(final String name) {
+ Site.showProgressProcessing();
+ contentServiceProvider.get().addContent(session.getUserHash(),
+ session.getCurrentState().getGroup().getShortName(),
+ session.getCurrentState().getFolder().getId(), name, new AsyncCallbackSimple<StateDTO>() {
+ public void onSuccess(final StateDTO state) {
+ Site.info(i18n.t("Created, now you can edit the document"));
+ stateManager.setRetrievedState(state);
+ Site.hideProgress();
+ }
+ });
+ }
+ });
+ contextItems.canCreate(i18n.t("New folder"), i18n.t("Add a folder"), new Slot<String>() {
+ public void onEvent(final String name) {
+ Site.showProgressProcessing();
+ contentServiceProvider.get().addFolder(session.getUserHash(),
+ session.getCurrentState().getGroup().getShortName(),
+ session.getCurrentState().getFolder().getId(), name, new AsyncCallbackSimple<StateDTO>() {
+ public void onSuccess(final StateDTO state) {
+ Site.info(i18n.t("Folder created"));
+ stateManager.setRetrievedState(state);
+ // FIXME: Isn't using cache
+ stateManager.reloadContextAndTitles();
+ Site.hideProgress();
+ }
+ });
+ }
+ });
+ contextItems.setParentTreeVisible(true);
}
public View getView() {
- return contextItems.getView();
+ return contextItems.getView();
}
public void setContainer(final StateToken state, final ContainerDTO container, final AccessRightsDTO rights) {
- contextItems.showContainer(state, container, rights);
+ contextItems.showContainer(state, container, rights);
}
}
Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/KunePlatform.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/KunePlatform.java 2008-08-09 18:40:32 UTC (rev 839)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/KunePlatform.java 2008-08-10 04:29:30 UTC (rev 840)
@@ -1,71 +0,0 @@
-/*
- *
- * Copyright (C) 2007-2008 The kune development team (see CREDITS for details)
- * This file is part of kune.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-package org.ourproject.kune.platf.client;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-
-import org.ourproject.kune.platf.client.dispatch.Action;
-import org.ourproject.kune.platf.client.dispatch.ActionEvent;
-import org.ourproject.kune.platf.client.extend.ClientModule;
-import org.ourproject.kune.platf.client.extend.Register;
-import org.ourproject.kune.platf.client.tool.ClientTool;
-
-public class KunePlatform implements Register {
- private final ArrayList<ClientTool> tools;
- private final ArrayList<ActionEvent<?>> actions;
-
- public KunePlatform() {
- this.tools = new ArrayList<ClientTool>();
- this.actions = new ArrayList<ActionEvent<?>>();
- }
-
- @SuppressWarnings("unchecked")
- public void addAction(final String eventName, final Action<?> action) {
- actions.add(new ActionEvent(eventName, action));
- }
-
- public void addTool(final ClientTool clientTool) {
- tools.add(clientTool);
- }
-
- public ArrayList<ActionEvent<?>> getActions() {
- return actions;
- }
-
- public HashMap<String, ClientTool> getIndexedTools() {
- final HashMap<String, ClientTool> toolsIndexed = new HashMap<String, ClientTool>();
- for (ClientTool tool : this.tools) {
- toolsIndexed.put(tool.getName(), tool);
- }
- return toolsIndexed;
- }
-
- public List<ClientTool> getTools() {
- return tools;
- }
-
- public void install(final ClientModule module) {
- module.configure(this);
- }
-
-}
Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/PlatformEvents.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/PlatformEvents.java 2008-08-09 18:40:32 UTC (rev 839)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/PlatformEvents.java 2008-08-10 04:29:30 UTC (rev 840)
@@ -1,26 +0,0 @@
-/*
- *
- * Copyright (C) 2007-2008 The kune development team (see CREDITS for details)
- * This file is part of kune.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-package org.ourproject.kune.platf.client;
-
-public interface PlatformEvents {
- public static final String ATTACH_TO_EXTENSIBLE_WIDGET = "ws.AttachToExtensibleWidget";
- public static final String DETACH_FROM_EXTENSIBLE_WIDGET = "ws.DetachToExtensibleWidget";
- public static final String CLEAR_EXTENSIBLE_WIDGET = "ws.ClearExtensionPoint";
-}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/app/Application.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/app/Application.java 2008-08-09 18:40:32 UTC (rev 839)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/app/Application.java 2008-08-10 04:29:30 UTC (rev 840)
@@ -20,28 +20,14 @@
package org.ourproject.kune.platf.client.app;
-import java.util.ArrayList;
-import java.util.HashMap;
-
-import org.ourproject.kune.platf.client.dispatch.ActionEvent;
-import org.ourproject.kune.platf.client.tool.ClientTool;
-
import com.calclab.suco.client.signal.Slot0;
public interface Application {
- ClientTool getTool(String toolName);
-
- void init(HashMap<String, ClientTool> tools);
-
void onApplicationStart(Slot0 slot);
void onApplicationStop(Slot0 slot);
void start();
- void stop();
-
- void subscribeActions(ArrayList<ActionEvent<?>> actions);
-
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/app/ApplicationDefault.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/app/ApplicationDefault.java 2008-08-09 18:40:32 UTC (rev 839)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/app/ApplicationDefault.java 2008-08-10 04:29:30 UTC (rev 840)
@@ -20,23 +20,12 @@
package org.ourproject.kune.platf.client.app;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-import org.ourproject.kune.platf.client.dispatch.ActionEvent;
-import org.ourproject.kune.platf.client.dispatch.DefaultDispatcher;
import org.ourproject.kune.platf.client.dto.InitDataDTO;
import org.ourproject.kune.platf.client.rpc.SiteService;
import org.ourproject.kune.platf.client.rpc.SiteServiceAsync;
-import org.ourproject.kune.platf.client.services.KuneErrorHandler;
import org.ourproject.kune.platf.client.state.Session;
-import org.ourproject.kune.platf.client.tool.ClientTool;
-import org.ourproject.kune.platf.client.ui.WindowUtils;
import org.ourproject.kune.platf.client.utils.PrefetchUtilities;
import org.ourproject.kune.workspace.client.sitebar.Site;
-import org.ourproject.kune.workspace.client.ui.newtmp.skel.WorkspaceSkeleton;
import com.allen_sauer.gwt.log.client.Log;
import com.calclab.suco.client.signal.Signal0;
@@ -48,15 +37,12 @@
import com.google.gwt.user.client.ui.RootPanel;
public class ApplicationDefault implements Application {
- // private final Workspace workspace;
- private Map<String, ClientTool> tools;
private final Session session;
private final Signal0 onApplicationStart;
private final Signal0 onApplicationStop;
- public ApplicationDefault(final Session session, final KuneErrorHandler errorHandler, final WorkspaceSkeleton ws) {
+ public ApplicationDefault(final Session session) {
this.session = session;
- tools = new HashMap<String, ClientTool>();
this.onApplicationStart = new Signal0("onApplicationStart");
this.onApplicationStop = new Signal0("onApplicationStop");
Window.addWindowCloseListener(new WindowCloseListener() {
@@ -70,14 +56,6 @@
});
}
- public ClientTool getTool(final String toolName) {
- return tools.get(toolName);
- }
-
- public void init(final HashMap<String, ClientTool> tools) {
- this.tools = tools;
- }
-
public void onApplicationStart(final Slot0 slot) {
onApplicationStart.add(slot);
}
@@ -98,19 +76,6 @@
prefetchTimer.schedule(20000);
}
- public void stop() {
- onApplicationStop.fire();
- }
-
- public void subscribeActions(final ArrayList<ActionEvent<?>> actions) {
- ActionEvent<?> actionEvent;
-
- for (final Iterator<ActionEvent<?>> it = actions.iterator(); it.hasNext();) {
- actionEvent = it.next();
- DefaultDispatcher.getInstance().subscribe(actionEvent.event, actionEvent.action);
- }
- }
-
private void getInitData() {
final SiteServiceAsync server = SiteService.App.getInstance();
server.getInitData(session.getUserHash(), new AsyncCallback<InitDataDTO>() {
@@ -121,20 +86,14 @@
}
public void onSuccess(final InitDataDTO initData) {
- checkChatDomain(initData.getChatDomain());
session.setInitData(initData);
session.setCurrentUserInfo(initData.getUserInfo());
RootPanel.get("kuneinitialcurtain").setVisible(false);
}
-
- private void checkChatDomain(final String chatDomain) {
- final String httpDomain = WindowUtils.getLocation().getHostName();
- if (!chatDomain.equals(httpDomain)) {
- Log.error("Your http domain (" + httpDomain + ") is different from the chat domain (" + chatDomain
- + "). This will produce problems with the chat functionality. "
- + "Check kune.properties on the server.");
- }
- }
});
}
+
+ private void stop() {
+ onApplicationStop.fire();
+ }
}
Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/dto/SaveDocumentActionParams.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/dto/SaveDocumentActionParams.java 2008-08-09 18:40:32 UTC (rev 839)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/dto/SaveDocumentActionParams.java 2008-08-10 04:29:30 UTC (rev 840)
@@ -1,41 +0,0 @@
-/*
- *
- * Copyright (C) 2007-2008 The kune development team (see CREDITS for details)
- * This file is part of kune.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-package org.ourproject.kune.platf.client.dto;
-
-import org.ourproject.kune.docs.client.cnt.DocumentContent;
-
-public class SaveDocumentActionParams {
- private final StateDTO stateDTO;
- private final DocumentContent documentContent;
-
- public SaveDocumentActionParams(final StateDTO stateDTO, final DocumentContent documentContent) {
- this.stateDTO = stateDTO;
- this.documentContent = documentContent;
- }
-
- public StateDTO getStateDTO() {
- return stateDTO;
- }
-
- public DocumentContent getDocumentContent() {
- return documentContent;
- }
-
-}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/rpc/ContentService.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/rpc/ContentService.java 2008-08-09 18:40:32 UTC (rev 839)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/rpc/ContentService.java 2008-08-10 04:29:30 UTC (rev 840)
@@ -30,33 +30,18 @@
import org.ourproject.kune.platf.client.dto.TagResultDTO;
import org.ourproject.kune.platf.client.errors.DefaultException;
-import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.RemoteService;
-import com.google.gwt.user.client.rpc.ServiceDefTarget;
public interface ContentService extends RemoteService {
- public static class App {
- private static ContentServiceAsync instance;
-
- public static ContentServiceAsync getInstance() {
- if (instance == null) {
- instance = (ContentServiceAsync) GWT.create(ContentService.class);
- ((ServiceDefTarget) instance).setServiceEntryPoint(GWT.getModuleBaseURL() + "ContentService");
-
- }
- return instance;
- }
- }
-
void addAuthor(String userHash, String groupShortName, String documentId, String authorShortName)
- throws DefaultException;
+ throws DefaultException;
CommentDTO addComment(String userHash, String groupShortName, String documentId, Long parentCommentId,
- String commentText) throws DefaultException;
+ String commentText) throws DefaultException;
CommentDTO addComment(String userHash, String groupShortName, String documentId, String commentText)
- throws DefaultException;
+ throws DefaultException;
StateDTO addContent(String user, String groupShortName, Long parentFolderId, String name) throws DefaultException;
@@ -71,25 +56,25 @@
List<TagResultDTO> getSummaryTags(String userHash, String groupShortName) throws DefaultException;
CommentDTO markCommentAsAbuse(String userHash, String groupShortName, String documentId, Long commentId)
- throws DefaultException;
+ throws DefaultException;
void rateContent(String userHash, String groupShortName, String documentId, Double value) throws DefaultException;
void removeAuthor(String userHash, String groupShortName, String documentId, String authorShortName)
- throws DefaultException;
+ throws DefaultException;
String rename(String userHash, String groupShortName, String token, String newName) throws DefaultException;
Integer save(String user, String groupShortName, String documentId, String content) throws DefaultException;
I18nLanguageDTO setLanguage(String userHash, String groupShortName, String documentId, String languageCode)
- throws DefaultException;
+ throws DefaultException;
void setPublishedOn(String userHash, String groupShortName, String documentId, Date date) throws DefaultException;
List<TagResultDTO> setTags(String userHash, String groupShortName, String documentId, String tags)
- throws DefaultException;
+ throws DefaultException;
CommentDTO voteComment(String userHash, String groupShortName, String documentId, Long commentId,
- boolean votePositive) throws DefaultException;
+ boolean votePositive) throws DefaultException;
}
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-08-09 18:40:32 UTC (rev 839)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneErrorHandler.java 2008-08-10 04:29:30 UTC (rev 840)
@@ -55,6 +55,12 @@
this.onSessionExpired = new Signal0("onSessionExpired");
}
+ public void doSessionExpired() {
+ onSessionExpired.fire();
+ getWorkspaceSkeleton().showAlertMessage(i18n.t("Session expired"),
+ i18n.t("Your session has expired. Please login again."));
+ }
+
public WorkspaceSkeleton getWorkspaceSkeleton() {
return wsProvider.get();
}
@@ -109,12 +115,6 @@
}
}
- private void doSessionExpired() {
- onSessionExpired.fire();
- getWorkspaceSkeleton().showAlertMessage(i18n.t("Session expired"),
- i18n.t("Your session has expired. Please login again."));
- }
-
private void logException(final Throwable e) {
logException(e, false);
}
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-08-09 18:40:32 UTC (rev 839)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneModule.java 2008-08-10 04:29:30 UTC (rev 840)
@@ -2,7 +2,6 @@
import org.ourproject.kune.chat.client.ChatClientNewModule;
import org.ourproject.kune.docs.client.DocumentClientNewModule;
-import org.ourproject.kune.platf.client.KunePlatform;
import org.ourproject.kune.platf.client.app.Application;
import org.ourproject.kune.platf.client.app.ApplicationDefault;
import org.ourproject.kune.platf.client.app.HistoryWrapper;
@@ -185,8 +184,10 @@
}
}, new Factory<ContentServiceAsync>(ContentServiceAsync.class) {
public ContentServiceAsync create() {
- // FIXME
- return ContentService.App.getInstance();
+ final ContentServiceAsync contentServiceAsync = (ContentServiceAsync) GWT.create(ContentService.class);
+ ((ServiceDefTarget) contentServiceAsync)
+ .setServiceEntryPoint(GWT.getModuleBaseURL() + "ContentService");
+ return contentServiceAsync;
}
});
@@ -264,19 +265,12 @@
final KuneErrorHandler errorHandler = $(KuneErrorHandler.class);
AsyncCallbackSimple.init(errorHandler);
- register(SingletonScope.class, new Factory<KunePlatform>(KunePlatform.class) {
- public KunePlatform create() {
- return new KunePlatform();
- }
- });
-
final WorkspaceSkeleton ws = $(WorkspaceSkeleton.class);
final Images images = $(Images.class);
register(SingletonScope.class, new Factory<Application>(Application.class) {
public Application create() {
- final Session session = $(Session.class);
- return new ApplicationDefault(session, $(KuneErrorHandler.class), ws);
+ return new ApplicationDefault($(Session.class));
}
});
@@ -452,7 +446,7 @@
register(SingletonScope.class, new Factory<EntityTitlePresenter>(EntityTitlePresenter.class) {
public EntityTitlePresenter create() {
final EntityTitlePresenter presenter = new EntityTitlePresenter(i18n, $(KuneErrorHandler.class),
- $(StateManager.class));
+ $(StateManager.class), $(Session.class), $$(ContentServiceAsync.class));
final EntityTitlePanel panel = new EntityTitlePanel(ws, presenter);
presenter.init(panel);
return presenter;
@@ -586,7 +580,8 @@
register(SingletonScope.class, new Factory<ContextItems>(ContextItems.class) {
public ContextItems create() {
- final ContextItemsPresenter presenter = new ContextItemsPresenter(i18n, $(StateManager.class));
+ final ContextItemsPresenter presenter = new ContextItemsPresenter(i18n, $(StateManager.class),
+ $(Session.class), $$(ContentServiceAsync.class));
final ContextItemsPanel panel = new ContextItemsPanel(presenter, i18n, $(StateManager.class));
presenter.init(panel);
return presenter;
@@ -638,9 +633,6 @@
}
});
- final KunePlatform platform = $(KunePlatform.class);
- $(Application.class).init(platform.getIndexedTools());
- $(Application.class).subscribeActions(platform.getActions());
$(Application.class).start();
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/state/Session.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/state/Session.java 2008-08-09 18:40:32 UTC (rev 839)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/state/Session.java 2008-08-10 04:29:30 UTC (rev 840)
@@ -68,6 +68,8 @@
public void setInitData(InitDataDTO initData);
+ UserInfoDTO getCurrentUserInfo();
+
String getUserHash();
void onInitDataReceived(Slot<InitDataDTO> slot);
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/SocialNetworkManagerDefault.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/SocialNetworkManagerDefault.java 2008-08-09 18:40:32 UTC (rev 839)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/SocialNetworkManagerDefault.java 2008-08-10 04:29:30 UTC (rev 840)
@@ -143,6 +143,8 @@
find(user, group); // check access
final Long groupId = group.getId();
final List<Group> adminInGroups = finder.findAdminInGroups(groupId);
+ // Don't show self user group
+ adminInGroups.remove(user.getUserGroup());
final List<Group> collabInGroups = finder.findCollabInGroups(groupId);
return new ParticipationData(adminInGroups, collabInGroups);
}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/items/ContextItems.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/items/ContextItems.java 2008-08-09 18:40:32 UTC (rev 839)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/items/ContextItems.java 2008-08-10 04:29:30 UTC (rev 840)
@@ -30,10 +30,8 @@
public interface ContextItems {
- public void canCreate(String typeName, String label, Slot<?> slot);
+ public void canCreate(String buttonTitle, String promptMessage, Slot<String> slot);
- public void canCreate(String typeName, String label, String eventName);
-
public View getView();
public void registerType(String typeName, AbstractImagePrototype pageWhite);
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-08-09 18:40:32 UTC (rev 839)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/items/ContextItemsPanel.java 2008-08-10 04:29:30 UTC (rev 840)
@@ -27,6 +27,7 @@
import org.ourproject.kune.platf.client.ui.HorizontalLine;
import org.ourproject.kune.platf.client.ui.IconLabel;
+import com.calclab.suco.client.signal.Slot;
import com.google.gwt.user.client.ui.AbstractImagePrototype;
import com.google.gwt.user.client.ui.ClickListener;
import com.google.gwt.user.client.ui.DockPanel;
@@ -39,14 +40,10 @@
private final VerticalPanel controls;
private final ItemsPanel items;
private final ContextTopBar topBar;
- private final ContextItemsPresenter presenter;
- private String currentEventName;
- private String workaroundTypeName;
private final I18nTranslationService i18n;
public ContextItemsPanel(final ContextItemsPresenter presenter, final I18nTranslationService i18n,
final StateManager stateManager) {
- this.presenter = presenter;
this.i18n = i18n;
topBar = new ContextTopBar(presenter, i18n, stateManager);
addTopBar(topBar);
@@ -70,17 +67,16 @@
horizontalLine.setWidth("100%");
}
- public void addCommand(final String typeName, final String label, final String eventName) {
- final String type = typeName;
- final IconLabel iconLabel = new IconLabel(Images.App.getInstance().addGreen(), label);
+ public void addCommand(final String buttonText, final String promptMessage, final Slot<String> slot) {
+ final IconLabel iconLabel = new IconLabel(Images.App.getInstance().addGreen(), buttonText);
iconLabel.addClickListener(new ClickListener() {
public void onClick(final Widget sender) {
- currentEventName = eventName;
- presenter.onNew(type);
+ promptName(promptMessage, slot);
}
});
iconLabel.addStyleName("kune-ContextItemsPanel-LabelLink");
controls.add(iconLabel);
+
}
public void addItem(final String name, final String type, final String event, final boolean editable) {
@@ -91,6 +87,14 @@
items.clear();
}
+ public void promptName(final String title, final Slot<String> slot) {
+ MessageBox.prompt(title, i18n.t("Please enter a name:"), new MessageBox.PromptCallback() {
+ public void execute(final String btnID, final String text) {
+ slot.onEvent(text);
+ }
+ });
+ }
+
public void registerType(final String typeName, final AbstractImagePrototype image) {
items.registerType(typeName, image);
}
@@ -119,28 +123,6 @@
topBar.firstRow.setVisible(visible);
}
- public void showCreationField(final String typeName) {
- String title;
- // Workaround: gwt-ext bug, I cannot use typeName directly
- workaroundTypeName = typeName;
-
- // FIXME use constants!!!!
- if (typeName.equals("docs.doc")) {
- title = i18n.t("Add a document");
- } else if (typeName.equals("docs.folder")) {
- title = i18n.t("Add a folder");
- } else if (typeName.equals("chat.room")) {
- title = i18n.t("Add a chat room");
- } else {
- title = i18n.t("Add a new [%s]", typeName);
- }
- 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);
- }
- });
- }
-
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-08-09 18:40:32 UTC (rev 839)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/items/ContextItemsPresenter.java 2008-08-10 04:29:30 UTC (rev 840)
@@ -22,20 +22,20 @@
import java.util.List;
-import org.ourproject.kune.docs.client.actions.DocsEvents;
import org.ourproject.kune.platf.client.View;
-import org.ourproject.kune.platf.client.dispatch.DefaultDispatcher;
-import org.ourproject.kune.platf.client.dispatch.Dispatcher;
import org.ourproject.kune.platf.client.dto.AccessRightsDTO;
import org.ourproject.kune.platf.client.dto.ContainerDTO;
import org.ourproject.kune.platf.client.dto.ContentDTO;
+import org.ourproject.kune.platf.client.dto.StateDTO;
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.rpc.ContentServiceAsync;
import org.ourproject.kune.platf.client.services.I18nTranslationService;
+import org.ourproject.kune.platf.client.state.Session;
import org.ourproject.kune.platf.client.state.StateManager;
import org.ourproject.kune.workspace.client.sitebar.Site;
+import com.calclab.suco.client.container.Provider;
import com.calclab.suco.client.signal.Slot;
import com.google.gwt.user.client.ui.AbstractImagePrototype;
@@ -43,27 +43,21 @@
protected ContextItemsView view;
private final I18nTranslationService i18n;
private final StateManager stateManager;
+ private final Session session;
+ private final Provider<ContentServiceAsync> contentServiceProvider;
- public ContextItemsPresenter(final I18nTranslationService i18n, final StateManager stateManager) {
+ public ContextItemsPresenter(final I18nTranslationService i18n, final StateManager stateManager,
+ final Session session, final Provider<ContentServiceAsync> contentServiceProvider) {
this.i18n = i18n;
this.stateManager = stateManager;
+ this.session = session;
+ this.contentServiceProvider = contentServiceProvider;
}
- public void canCreate(final String typeName, final String label, final Slot<?> slot) {
- // TODO
+ public void canCreate(final String buttonText, final String promptMessage, final Slot<String> slot) {
+ view.addCommand(buttonText, promptMessage, slot);
}
- public void canCreate(final String typeName, final String label, final String 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);
- }
- }
-
public View getView() {
return view;
}
@@ -73,22 +67,23 @@
}
public void onGoUp() {
- DefaultDispatcher.getInstance().fire(DocsEvents.GO_PARENT_FOLDER, null);
+ final StateDTO state = session.getCurrentState();
+ final StateToken token = state.getStateToken();
+ token.setDocument(null);
+ token.setFolder(state.getFolder().getParentFolderId().toString());
+ stateManager.setState(token);
}
- public void onNew(final String typeName) {
- view.showCreationField(typeName);
- }
-
- public void onTitleRename(final String text, final String token) {
+ public void onTitleRename(final String newName, 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) {
+ final StateDTO currentState = session.getCurrentState();
+ contentServiceProvider.get().rename(session.getUserHash(), currentState.getGroup().getShortName(), token,
+ newName, new AsyncCallbackSimple<String>() {
+ public void onSuccess(final String result) {
stateManager.reloadContextAndTitles();
Site.hideProgress();
}
- }));
+ });
}
public void registerType(final String typeName, final AbstractImagePrototype image) {
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/items/ContextItemsView.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/items/ContextItemsView.java 2008-08-09 18:40:32 UTC (rev 839)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/items/ContextItemsView.java 2008-08-10 04:29:30 UTC (rev 840)
@@ -23,15 +23,23 @@
import org.ourproject.kune.platf.client.View;
import org.ourproject.kune.platf.client.dto.ContainerSimpleDTO;
+import com.calclab.suco.client.signal.Slot;
import com.google.gwt.user.client.ui.AbstractImagePrototype;
public interface ContextItemsView extends View {
- void clear();
+ void addCommand(String buttonTitle, String promptMessage, Slot<String> slot);
+
void addItem(String name, String type, String event, boolean editable);
+ void clear();
+
+ void registerType(String typeName, AbstractImagePrototype image);
+
void selectItem(int index);
+ void setAbsolutePath(ContainerSimpleDTO[] absolutePath);
+
void setControlsVisible(boolean isVisible);
void setCurrentName(String name);
@@ -40,12 +48,4 @@
void setParentTreeVisible(boolean b);
- void registerType(String typeName, AbstractImagePrototype image);
-
- void addCommand(String typeName, String label, String eventName);
-
- void showCreationField(String typeName);
-
- void setAbsolutePath(ContainerSimpleDTO[] absolutePath);
-
}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/siteusermenu/SiteUserMenuPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/siteusermenu/SiteUserMenuPanel.java 2008-08-09 18:40:32 UTC (rev 839)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/siteusermenu/SiteUserMenuPanel.java 2008-08-10 04:29:30 UTC (rev 840)
@@ -34,6 +34,16 @@
userMenu.showAt(sender.getAbsoluteLeft(), sender.getAbsoluteTop() + 10);
}
});
+ final Item userHomePage = new Item(i18n.t("Your homepage"));
+ userHomePage.setIcon("images/group-home.gif");
+ userHomePage.addListener(new BaseItemListenerAdapter() {
+ @Override
+ public void onClick(final BaseItem item, final EventObject e) {
+ super.onClick(item, e);
+ presenter.onUserHomePage();
+ }
+ });
+ userMenu.addItem(userHomePage);
final Item userPreferences = new Item(i18n.t("Your preferences"));
userPreferences.setIcon("images/kune-preferences.gif");
userPreferences.addListener(new BaseItemListenerAdapter() {
@@ -55,8 +65,8 @@
}
public void setParticipation(final MenuItemCollection<GroupDTO> participateInGroups) {
+ userParticipation.removeAll();
for (final org.ourproject.kune.platf.client.ui.MenuItem<GroupDTO> groupItem : participateInGroups) {
- userParticipation.removeAll();
final Item item = new Item(groupItem.getTitle(), new BaseItemListenerAdapter() {
@Override
public void onClick(BaseItem item, EventObject e) {
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/siteusermenu/SiteUserMenuPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/siteusermenu/SiteUserMenuPresenter.java 2008-08-09 18:40:32 UTC (rev 839)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/siteusermenu/SiteUserMenuPresenter.java 2008-08-10 04:29:30 UTC (rev 840)
@@ -16,8 +16,10 @@
private SiteUserMenuView view;
private final MenuItemCollection<GroupDTO> participateInGroups;
private final StateManager stateManager;
+ private final Session session;
public SiteUserMenuPresenter(final Session session, final StateManager stateManager) {
+ this.session = session;
this.stateManager = stateManager;
participateInGroups = new MenuItemCollection<GroupDTO>();
session.onUserSignIn(new Slot<UserInfoDTO>() {
@@ -42,6 +44,10 @@
this.view = view;
}
+ public void onUserHomePage() {
+ stateManager.gotoToken(session.getCurrentUserInfo().getShortName());
+ }
+
public void onUserPreferences() {
// TODO Auto-generated method stub
}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/title/EntityTitlePresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/title/EntityTitlePresenter.java 2008-08-09 18:40:32 UTC (rev 839)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/title/EntityTitlePresenter.java 2008-08-10 04:29:30 UTC (rev 840)
@@ -22,16 +22,16 @@
import java.util.Date;
-import org.ourproject.kune.docs.client.actions.DocsEvents;
import org.ourproject.kune.platf.client.View;
-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.rpc.ContentServiceAsync;
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.workspace.client.sitebar.Site;
+import com.calclab.suco.client.container.Provider;
import com.calclab.suco.client.signal.Slot;
import com.google.gwt.i18n.client.DateTimeFormat;
import com.google.gwt.user.client.rpc.AsyncCallback;
@@ -42,12 +42,17 @@
private final I18nTranslationService i18n;
private final KuneErrorHandler errorHandler;
private final StateManager stateManager;
+ private final Provider<ContentServiceAsync> contentServiceProvider;
+ private final Session session;
public EntityTitlePresenter(final I18nTranslationService i18n, final KuneErrorHandler errorHandler,
- final StateManager stateManager) {
+ final StateManager stateManager, final Session session,
+ final Provider<ContentServiceAsync> contentServiceProvider) {
this.i18n = i18n;
this.errorHandler = errorHandler;
this.stateManager = stateManager;
+ this.session = session;
+ this.contentServiceProvider = contentServiceProvider;
stateManager.onStateChanged(new Slot<StateDTO>() {
public void onEvent(final StateDTO state) {
setState(state);
@@ -63,25 +68,26 @@
this.view = view;
}
- public void onTitleRename(final String text) {
+ public void onTitleRename(final String newName) {
Site.showProgressSaving();
- final AsyncCallback<String> callback = new AsyncCallback<String>() {
- public void onFailure(final Throwable caught) {
- view.restoreOldTitle();
- errorHandler.process(caught);
- }
+ final StateDTO currentState = session.getCurrentState();
+ contentServiceProvider.get().rename(session.getUserHash(), currentState.getGroup().getShortName(),
+ currentState.getStateToken().getEncoded(), newName, 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);
- stateManager.reloadContextAndTitles();
- }
- };
- DefaultDispatcher.getInstance().fire(DocsEvents.RENAME_CONTENT,
- new ParamCallback<String, String>(text, callback));
+ public void onSuccess(final String result) {
+ Site.hideProgress();
+ view.setContentTitle(result);
+ stateManager.reloadContextAndTitles();
+ }
+ });
+ Site.hideProgress();
}
- private void setContentDate(final Date publishedOn) {
+ public void setContentDate(final Date publishedOn) {
final DateTimeFormat fmt = DateTimeFormat.getFormat("MM/dd/yyyy, Z");
view.setContentDate(i18n.t("Published on: [%s]", fmt.format(publishedOn)));
}
Modified: trunk/src/test/java/org/ourproject/kune/platf/server/mapper/MapperTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/server/mapper/MapperTest.java 2008-08-09 18:40:32 UTC (rev 839)
+++ trunk/src/test/java/org/ourproject/kune/platf/server/mapper/MapperTest.java 2008-08-10 04:29:30 UTC (rev 840)
@@ -51,6 +51,8 @@
@Test
public void customPropertiesInUserInfoMappping() {
+ // Make a custom converter instead of mapper.mapProperties
+ // http://dozer.sourceforge.net/documentation/customconverter.html
final UserInfo userInfo = new UserInfo();
final ChatUserParams userChatParams = new ChatUserParams("avatar", true, SubscriptionMode.autoAcceptAll,
"color");
@@ -64,6 +66,7 @@
@Test
public void customPropertiesMappping() throws ClassNotFoundException {
+ // Make a custom converter instead of mapper.mapProperties
final ChatUserParams userChatParams = new ChatUserParams("avatar", true, SubscriptionMode.autoAcceptAll,
"color");
final CustomProperties customProperties = new CustomProperties();
Copied: trunk/src/test/java/org/ourproject/kune/workspace/client/sitebar/msg/SiteMessagePresenterTest.java (from rev 828, trunk/src/test/java/org/ourproject/kune/sitebar/client/msg/SiteMessagePresenterTest.java)
===================================================================
--- trunk/src/test/java/org/ourproject/kune/sitebar/client/msg/SiteMessagePresenterTest.java 2008-08-05 01:29:31 UTC (rev 828)
+++ trunk/src/test/java/org/ourproject/kune/workspace/client/sitebar/msg/SiteMessagePresenterTest.java 2008-08-10 04:29:30 UTC (rev 840)
@@ -0,0 +1,68 @@
+package org.ourproject.kune.workspace.client.sitebar.msg;
+
+import org.easymock.EasyMock;
+import org.junit.Before;
+import org.junit.Test;
+import org.ourproject.kune.workspace.client.newgroup.SiteErrorType;
+import org.ourproject.kune.workspace.client.sitebar.msg.SiteMessagePresenter;
+import org.ourproject.kune.workspace.client.sitebar.msg.SiteMessageView;
+
+public class SiteMessagePresenterTest {
+
+ private SiteMessagePresenter presenter;
+ private SiteMessageView view;
+
+ @Before
+ public void createObjects() {
+ view = EasyMock.createStrictMock(SiteMessageView.class);
+ presenter = new SiteMessagePresenter();
+ }
+
+ @Test
+ public void testMessage() {
+ view.hide();
+ view.setMessage("test 1", SiteErrorType.info, SiteErrorType.error);
+ view.show();
+ EasyMock.replay(view);
+ presenter.init(view);
+ presenter.setMessage("test 1", SiteErrorType.error);
+ EasyMock.verify(view);
+ }
+
+ @Test
+ public void testTwoMessagesDifTypes() {
+ view.hide();
+ view.setMessage("test 1", SiteErrorType.info, SiteErrorType.veryimp);
+ view.show();
+ view.setMessage("test 1<br>test 2", SiteErrorType.veryimp, SiteErrorType.error);
+ view.show();
+ EasyMock.replay(view);
+ presenter.init(view);
+ presenter.setMessage("test 1", SiteErrorType.veryimp);
+ presenter.setMessage("test 2", SiteErrorType.error);
+ EasyMock.verify(view);
+ }
+
+ @Test
+ public void testTwoMessagesSameType() {
+ view.hide();
+ view.setMessage("test 1", SiteErrorType.info, SiteErrorType.error);
+ view.show();
+ view.setMessage("test 1<br>test 2");
+ view.show();
+ EasyMock.replay(view);
+ presenter.init(view);
+ presenter.setMessage("test 1", SiteErrorType.error);
+ presenter.setMessage("test 2", SiteErrorType.error);
+ EasyMock.verify(view);
+ }
+
+ @Test
+ public void testViewInitialization() {
+ view.hide();
+ EasyMock.replay(view);
+ presenter.init(view);
+ EasyMock.verify(view);
+ }
+
+}
More information about the kune-commits
mailing list