[kune-commits] r823 - in trunk/src:
main/java/org/ourproject/kune/chat/client
main/java/org/ourproject/kune/chat/client/cnt
main/java/org/ourproject/kune/chat/client/cnt/room
main/java/org/ourproject/kune/chat/client/ctx/rooms
main/java/org/ourproject/kune/docs/client/ctx/admin
main/java/org/ourproject/kune/docs/client/ctx/admin/ui
main/java/org/ourproject/kune/platf/client
main/java/org/ourproject/kune/platf/client/actions
main/java/org/ourproject/kune/platf/client/app
main/java/org/ourproject/kune/platf/client/services
main/java/org/ourproject/kune/platf/client/state
main/java/org/ourproject/kune/platf/client/ui
main/java/org/ourproject/kune/platf/client/ui/rate
main/java/org/ourproject/kune/platf/client/ui/stacks
main/java/org/ourproject/kune/platf/client/utils
main/java/org/ourproject/kune/workspace/client
main/java/org/ourproject/kune/workspace/client/actions
main/java/org/ourproject/kune/workspace/client/presence/ui
main/java/org/ourproject/kune/workspace/client/search
main/java/org/ourproject/kune/workspace/client/socialnet
main/java/org/ourproject/kune/workspace/client/summary
main/java/org/ourproject/kune/workspace/client/tags
main/java/org/ourproject/kune/workspace/client/ui/ctx/items
main/java/org/ourproject/kune/workspace/client/ui/newtmp
main/java/org/ourproject/kune/workspace/client/ui/newtmp/licensefoot
main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/sitepublic
main/java/org/ourproject/kune/workspace/client/ui/newtmp/themes
main/java/org/ourproject/kune/workspace/client/ui/newtmp/title
main/java/org/ourproject/kune/workspace/client/workspace
main/java/org/ourproject/kune/workspace/client/workspace/ui
test/java/org/ourproject/kune/platf/client/state
vjrj
vjrj at ourproject.org
Fri Aug 1 12:53:50 CEST 2008
Author: vjrj
Date: 2008-08-01 12:53:22 +0200 (Fri, 01 Aug 2008)
New Revision: 823
Added:
trunk/src/main/java/org/ourproject/kune/workspace/client/workspace/ui/EntityLogoPresenter.java
trunk/src/main/java/org/ourproject/kune/workspace/client/workspace/ui/EntityLogoView.java
Removed:
trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientModule.java
trunk/src/main/java/org/ourproject/kune/chat/client/ChatEvents.java
trunk/src/main/java/org/ourproject/kune/platf/client/AbstractPresenter.java
trunk/src/main/java/org/ourproject/kune/platf/client/PlatformClientModule.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/GotoAction.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/stacks/IndexedStackPanel.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/stacks/IndexedStackPanelWithSubItems.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/stacks/StackSubItemAction.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/stacks/StackedDropDownPanel.java
trunk/src/main/java/org/ourproject/kune/workspace/client/actions/AttachToExtensibleWidgetAction.java
trunk/src/main/java/org/ourproject/kune/workspace/client/actions/ClearExtensibleWidgetAction.java
trunk/src/main/java/org/ourproject/kune/workspace/client/actions/DetachFromExtensibleWidgetAction.java
Modified:
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/ChatFactory.java
trunk/src/main/java/org/ourproject/kune/chat/client/ChatToolComponents.java
trunk/src/main/java/org/ourproject/kune/chat/client/cnt/ChatContentPresenter.java
trunk/src/main/java/org/ourproject/kune/chat/client/cnt/room/ChatRoomControl.java
trunk/src/main/java/org/ourproject/kune/chat/client/ctx/rooms/RoomsAdminPresenter.java
trunk/src/main/java/org/ourproject/kune/docs/client/ctx/admin/AdminContextPresenter.java
trunk/src/main/java/org/ourproject/kune/docs/client/ctx/admin/ui/AdminContextPanel.java
trunk/src/main/java/org/ourproject/kune/platf/client/PlatformEvents.java
trunk/src/main/java/org/ourproject/kune/platf/client/app/ApplicationDefault.java
trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneErrorHandler.java
trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneModule.java
trunk/src/main/java/org/ourproject/kune/platf/client/state/StateManager.java
trunk/src/main/java/org/ourproject/kune/platf/client/state/StateManagerDefault.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/UnknowComponent.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/rate/RateIt.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/rate/RateItPresenter.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/rate/RatePresenter.java
trunk/src/main/java/org/ourproject/kune/platf/client/utils/PrefetchUtilities.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/presence/ui/GroupSummaryPanel.java
trunk/src/main/java/org/ourproject/kune/workspace/client/search/SiteSearcherPresenter.java
trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/GroupMembersSummaryPresenter.java
trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/ParticipationSummaryPresenter.java
trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/SocialNetworkPresenter.java
trunk/src/main/java/org/ourproject/kune/workspace/client/summary/GroupSummaryPresenter.java
trunk/src/main/java/org/ourproject/kune/workspace/client/tags/TagsSummaryPresenter.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/ContextTopBar.java
trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/WorkspaceManager.java
trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/licensefoot/EntityLicensePresenter.java
trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/sitepublic/SitePublicSpaceLink.java
trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/sitepublic/SitePublicSpaceLinkPresenter.java
trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/themes/WsThemePresenter.java
trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/title/EntitySubTitlePresenter.java
trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/title/EntityTitlePresenter.java
trunk/src/main/java/org/ourproject/kune/workspace/client/workspace/GroupMembersSummary.java
trunk/src/main/java/org/ourproject/kune/workspace/client/workspace/GroupSummary.java
trunk/src/main/java/org/ourproject/kune/workspace/client/workspace/ParticipationSummary.java
trunk/src/main/java/org/ourproject/kune/workspace/client/workspace/TagsSummary.java
trunk/src/main/java/org/ourproject/kune/workspace/client/workspace/Workspace.java
trunk/src/main/java/org/ourproject/kune/workspace/client/workspace/ui/EntityLogo.java
trunk/src/main/java/org/ourproject/kune/workspace/client/workspace/ui/EntityLogoPanel.java
trunk/src/test/java/org/ourproject/kune/platf/client/state/StateManagerTest.java
Log:
Workspace refactorization
Deleted: trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientModule.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientModule.java 2008-07-31 13:28:16 UTC (rev 822)
+++ trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientModule.java 2008-08-01 10:53:22 UTC (rev 823)
@@ -1,42 +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.chat.client;
-
-import org.ourproject.kune.chat.client.actions.AddRoomAction;
-import org.ourproject.kune.platf.client.extend.ClientModule;
-import org.ourproject.kune.platf.client.extend.Register;
-import org.ourproject.kune.platf.client.state.Session;
-import org.ourproject.kune.platf.client.state.StateManager;
-
-public class ChatClientModule implements ClientModule {
-
- private final Session session;
- private final StateManager stateManager;
-
- public ChatClientModule(final Session session, final StateManager stateManager, final ChatClientTool chatTool) {
- this.session = session;
- this.stateManager = stateManager;
- }
-
- public void configure(final Register register) {
- register.addAction(ChatEvents.ADD_ROOM, new AddRoomAction(session, stateManager));
- }
-}
Modified: trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientNewModule.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientNewModule.java 2008-07-31 13:28:16 UTC (rev 822)
+++ trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientNewModule.java 2008-08-01 10:53:22 UTC (rev 823)
@@ -2,6 +2,7 @@
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;
import org.ourproject.kune.platf.client.state.StateManager;
import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService;
@@ -24,12 +25,12 @@
register(SingletonScope.class, new Factory<ChatClientTool>(ChatClientTool.class) {
public ChatClientTool create() {
return new ChatClientTool($(Session.class), $(Application.class), $(I18nUITranslationService.class),
- $(EmiteUIDialog.class), $(WorkspaceSkeleton.class), $p(GroupMembersSummary.class));
+ $(EmiteUIDialog.class), $(WorkspaceSkeleton.class), $p(GroupMembersSummary.class),
+ $p(StateManager.class), $p(ContentServiceAsync.class));
}
});
final ChatClientTool chatClientTool = $(ChatClientTool.class);
$(KunePlatform.class).addTool(chatClientTool);
- $(KunePlatform.class).install(new ChatClientModule($(Session.class), $(StateManager.class), chatClientTool));
}
}
Modified: trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientTool.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientTool.java 2008-07-31 13:28:16 UTC (rev 822)
+++ trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientTool.java 2008-08-01 10:53:22 UTC (rev 823)
@@ -25,8 +25,10 @@
import org.ourproject.kune.platf.client.dto.InitDataDTO;
import org.ourproject.kune.platf.client.dto.StateDTO;
import org.ourproject.kune.platf.client.dto.UserInfoDTO;
+import org.ourproject.kune.platf.client.rpc.ContentServiceAsync;
import org.ourproject.kune.platf.client.services.I18nTranslationService;
import org.ourproject.kune.platf.client.state.Session;
+import org.ourproject.kune.platf.client.state.StateManager;
import org.ourproject.kune.platf.client.tool.AbstractClientTool;
import org.ourproject.kune.platf.client.ui.gridmenu.GridMenuItem;
import org.ourproject.kune.workspace.client.component.WorkspaceComponent;
@@ -45,12 +47,18 @@
public static final String TYPE_CHAT = "chat.chat";
private final ChatToolComponents components;
private ChatEngine chat;
+ private final Provider<StateManager> stateManagerProvider;
+ private final Provider<ContentServiceAsync> contentServiceProvider;
public ChatClientTool(final Session session, final Application application, final I18nTranslationService i18n,
final EmiteUIDialog emiteUIDialog, final WorkspaceSkeleton ws,
- final Provider<GroupMembersSummary> groupMembersSummaryProvider) {
+ final Provider<GroupMembersSummary> groupMembersSummaryProvider,
+ final Provider<StateManager> stateManagerProvider,
+ final Provider<ContentServiceAsync> contentServiceProvider) {
super(i18n.t("chat rooms"));
- components = new ChatToolComponents(emiteUIDialog, i18n);
+ this.stateManagerProvider = stateManagerProvider;
+ this.contentServiceProvider = contentServiceProvider;
+ components = new ChatToolComponents(emiteUIDialog, i18n, stateManagerProvider, session, contentServiceProvider);
session.onInitDataReceived(new Slot<InitDataDTO>() {
public void onEvent(final InitDataDTO initData) {
final ChatOptions chatOptions = new ChatOptions(initData.getChatHttpBase(), initData.getChatDomain(),
Deleted: trunk/src/main/java/org/ourproject/kune/chat/client/ChatEvents.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/chat/client/ChatEvents.java 2008-07-31 13:28:16 UTC (rev 822)
+++ trunk/src/main/java/org/ourproject/kune/chat/client/ChatEvents.java 2008-08-01 10:53:22 UTC (rev 823)
@@ -1,25 +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.chat.client;
-
-public interface ChatEvents {
- public static final String ADD_ROOM = "chats.AddRoom";
- public static final String JOIN_ROOM = "chats.JoinRoom";
-}
Modified: trunk/src/main/java/org/ourproject/kune/chat/client/ChatFactory.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/chat/client/ChatFactory.java 2008-07-31 13:28:16 UTC (rev 822)
+++ trunk/src/main/java/org/ourproject/kune/chat/client/ChatFactory.java 2008-08-01 10:53:22 UTC (rev 823)
@@ -35,19 +35,31 @@
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.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.WorkspaceFactory;
import org.ourproject.kune.workspace.client.component.WorkspaceDeckPanel;
import org.ourproject.kune.workspace.client.ui.ctx.items.ContextItems;
import com.calclab.emiteuimodule.client.EmiteUIDialog;
+import com.calclab.suco.client.container.Provider;
public class ChatFactory {
private static I18nTranslationService i18n;
+ private static Provider<StateManager> stateManagerProvider;
+ private static Session session;
+ private static Provider<ContentServiceAsync> contentServiceProvider;
- public static ChatContent createChatContent(final EmiteUIDialog emiteUIDialog, final I18nTranslationService i18n) {
+ public static ChatContent createChatContent(final EmiteUIDialog emiteUIDialog, final I18nTranslationService i18n,
+ final Provider<StateManager> stateManagerProvider, final Session session,
+ final Provider<ContentServiceAsync> contentServiceProvider) {
ChatFactory.i18n = i18n;
+ ChatFactory.stateManagerProvider = stateManagerProvider;
+ ChatFactory.session = session;
+ ChatFactory.contentServiceProvider = contentServiceProvider;
final WorkspaceDeckPanel panel = new WorkspaceDeckPanel();
final ChatContentPresenter presenter = new ChatContentPresenter(emiteUIDialog, panel);
return presenter;
@@ -78,7 +90,8 @@
public static RoomsAdmin createRoomsAdmin() {
final ContextItems contextItems = WorkspaceFactory.createContextItems();
- final RoomsAdminPresenter presenter = new RoomsAdminPresenter(contextItems, i18n);
+ final RoomsAdminPresenter presenter = new RoomsAdminPresenter(contextItems, i18n, stateManagerProvider,
+ session, contentServiceProvider);
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-07-31 13:28:16 UTC (rev 822)
+++ trunk/src/main/java/org/ourproject/kune/chat/client/ChatToolComponents.java 2008-08-01 10:53:22 UTC (rev 823)
@@ -22,33 +22,46 @@
import org.ourproject.kune.chat.client.cnt.ChatContent;
import org.ourproject.kune.chat.client.ctx.ChatContext;
+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 com.calclab.emiteuimodule.client.EmiteUIDialog;
+import com.calclab.suco.client.container.Provider;
class ChatToolComponents {
private ChatContent content;
private ChatContext context;
private final EmiteUIDialog emiteUIDialog;
private final I18nTranslationService i18n;
+ private final Provider<StateManager> stateManagerProvider;
+ private final Session session;
+ private final Provider<ContentServiceAsync> contentServiceProvider;
- public ChatToolComponents(final EmiteUIDialog emiteUIDialog, final I18nTranslationService i18n) {
- this.emiteUIDialog = emiteUIDialog;
- this.i18n = i18n;
+ public ChatToolComponents(final EmiteUIDialog emiteUIDialog, final I18nTranslationService i18n,
+ final Provider<StateManager> stateManagerProvider, final Session session,
+ final Provider<ContentServiceAsync> contentServiceProvider) {
+ this.emiteUIDialog = emiteUIDialog;
+ this.i18n = i18n;
+ this.stateManagerProvider = stateManagerProvider;
+ this.session = session;
+ this.contentServiceProvider = contentServiceProvider;
}
public ChatContent getContent() {
- if (content == null) {
- content = ChatFactory.createChatContent(emiteUIDialog, i18n);
- }
- return content;
+ if (content == null) {
+ content = ChatFactory.createChatContent(emiteUIDialog, i18n, stateManagerProvider, session,
+ contentServiceProvider);
+ }
+ return content;
}
public ChatContext getContext() {
- if (context == null) {
- context = ChatFactory.createChatContext();
- }
- return context;
+ if (context == null) {
+ context = ChatFactory.createChatContext();
+ }
+ return context;
}
}
Modified: trunk/src/main/java/org/ourproject/kune/chat/client/cnt/ChatContentPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/chat/client/cnt/ChatContentPresenter.java 2008-07-31 13:28:16 UTC (rev 822)
+++ trunk/src/main/java/org/ourproject/kune/chat/client/cnt/ChatContentPresenter.java 2008-08-01 10:53:22 UTC (rev 823)
@@ -28,7 +28,6 @@
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.extend.ExtensibleWidgetChild;
import org.ourproject.kune.platf.client.extend.ExtensibleWidgetId;
import org.ourproject.kune.platf.client.ui.UnknowComponent;
import org.ourproject.kune.workspace.client.component.WorkspaceDeckView;
@@ -44,9 +43,9 @@
private final EmiteUIDialog emiteUIDialog;
public ChatContentPresenter(final EmiteUIDialog emiteUIDialog, final WorkspaceDeckView view) {
- this.emiteUIDialog = emiteUIDialog;
- this.view = view;
- this.components = new ChatComponents(this);
+ this.emiteUIDialog = emiteUIDialog;
+ this.view = view;
+ this.components = new ChatComponents(this);
}
public void attach() {
@@ -56,36 +55,32 @@
}
public View getView() {
- return view;
+ return view;
}
public void onEnterRoom() {
- String roomName = state.getFolder().getName();
- emiteUIDialog.joinRoom(XmppURI.uri(roomName));
+ final String roomName = state.getFolder().getName();
+ emiteUIDialog.joinRoom(XmppURI.uri(roomName));
}
public void setState(final StateDTO state) {
- this.state = state;
- String typeId = state.getTypeId();
- if (typeId.equals(ChatClientTool.TYPE_ROOT)) {
- ChatInfo info = components.getChatInfo();
- view.show(info.getView());
- DefaultDispatcher.getInstance().fire(PlatformEvents.CLEAR_EXTENSIBLE_WIDGET,
- ExtensibleWidgetId.CONTENT_TOOLBAR_LEFT);
- } else if (typeId.equals(ChatClientTool.TYPE_ROOM)) {
- ChatRoom viewer = components.getChatRoom();
- view.show(viewer.getView());
- DefaultDispatcher.getInstance().fire(PlatformEvents.CLEAR_EXTENSIBLE_WIDGET,
- ExtensibleWidgetId.CONTENT_TOOLBAR_LEFT);
- DefaultDispatcher.getInstance().fire(
- PlatformEvents.ATTACH_TO_EXTENSIBLE_WIDGET,
- new ExtensibleWidgetChild(ExtensibleWidgetId.CONTENT_TOOLBAR_LEFT, components.getChatRoomControl()
- .getView()));
- } else {
- view.show(UnknowComponent.instance.getView());
- DefaultDispatcher.getInstance().fire(PlatformEvents.CLEAR_EXTENSIBLE_WIDGET,
- ExtensibleWidgetId.CONTENT_TOOLBAR_LEFT);
- }
+ this.state = state;
+ final String typeId = state.getTypeId();
+ if (typeId.equals(ChatClientTool.TYPE_ROOT)) {
+ final ChatInfo info = components.getChatInfo();
+ view.show(info.getView());
+ DefaultDispatcher.getInstance().fire(PlatformEvents.CLEAR_EXTENSIBLE_WIDGET,
+ ExtensibleWidgetId.CONTENT_TOOLBAR_LEFT);
+ } else if (typeId.equals(ChatClientTool.TYPE_ROOM)) {
+ final ChatRoom viewer = components.getChatRoom();
+ view.show(viewer.getView());
+ DefaultDispatcher.getInstance().fire(PlatformEvents.CLEAR_EXTENSIBLE_WIDGET,
+ ExtensibleWidgetId.CONTENT_TOOLBAR_LEFT);
+ } else {
+ view.show(UnknowComponent.instance.getView());
+ DefaultDispatcher.getInstance().fire(PlatformEvents.CLEAR_EXTENSIBLE_WIDGET,
+ ExtensibleWidgetId.CONTENT_TOOLBAR_LEFT);
+ }
}
}
Modified: trunk/src/main/java/org/ourproject/kune/chat/client/cnt/room/ChatRoomControl.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/chat/client/cnt/room/ChatRoomControl.java 2008-07-31 13:28:16 UTC (rev 822)
+++ trunk/src/main/java/org/ourproject/kune/chat/client/cnt/room/ChatRoomControl.java 2008-08-01 10:53:22 UTC (rev 823)
@@ -22,4 +22,5 @@
import org.ourproject.kune.platf.client.Component;
public interface ChatRoomControl extends Component {
+
}
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-07-31 13:28:16 UTC (rev 822)
+++ trunk/src/main/java/org/ourproject/kune/chat/client/ctx/rooms/RoomsAdminPresenter.java 2008-08-01 10:53:22 UTC (rev 823)
@@ -21,40 +21,66 @@
package org.ourproject.kune.chat.client.ctx.rooms;
import org.ourproject.kune.chat.client.ChatClientTool;
-import org.ourproject.kune.chat.client.ChatEvents;
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 RoomsAdminPresenter implements RoomsAdmin {
private 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, i18n.t("New chat room"), ChatEvents.ADD_ROOM);
+ public RoomsAdminPresenter(final ContextItems contextItems, final I18nTranslationService i18n,
+ final Provider<StateManager> stateManagerProvider, final Session session,
+ final Provider<ContentServiceAsync> contentServiceProvider) {
+ this.contextItems = contextItems;
+ final 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, i18n.t("New chat room"), new Slot<String>() {
+ public void onEvent(final String name) {
+ Site.showProgressProcessing();
+ final String groupShortName = session.getCurrentState().getGroup().getShortName();
+ final Long containerId = session.getCurrentState().getFolder().getId();
+ contentServiceProvider.get().addRoom(session.getUserHash(), groupShortName, containerId,
+ groupShortName + "-" + name, new AsyncCallbackSimple<StateDTO>() {
+ public void onSuccess(final StateDTO state) {
+ final StateManager stateManager = stateManagerProvider.get();
+ stateManager.setRetrievedState(state);
+ // FIXME: Isn't using cache (same in Add folder)
+ stateManager.reloadContextAndTitles();
+ Site.hideProgress();
+ }
+ });
+ }
+ });
}
public View getView() {
- return contextItems.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
public void showRoom(final StateToken token, final ContainerDTO container, final AccessRightsDTO rights) {
- contextItems.showContainer(token, container, rights);
- String type = container.getTypeId();
- if (type.equals(ChatClientTool.TYPE_ROOM)) {
- contextItems.setControlsVisible(false);
- }
+ contextItems.showContainer(token, container, rights);
+ final String type = container.getTypeId();
+ if (type.equals(ChatClientTool.TYPE_ROOM)) {
+ contextItems.setControlsVisible(false);
+ }
}
}
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-07-31 13:28:16 UTC (rev 822)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/ctx/admin/AdminContextPresenter.java 2008-08-01 10:53:22 UTC (rev 823)
@@ -24,7 +24,6 @@
import java.util.List;
import org.ourproject.kune.docs.client.actions.DocsEvents;
-import org.ourproject.kune.platf.client.AbstractPresenter;
import org.ourproject.kune.platf.client.View;
import org.ourproject.kune.platf.client.dispatch.DefaultDispatcher;
import org.ourproject.kune.platf.client.dto.AccessListsDTO;
@@ -41,7 +40,7 @@
import com.calclab.suco.client.container.Provider;
-public class AdminContextPresenter extends AbstractPresenter implements AdminContext {
+public class AdminContextPresenter implements AdminContext {
private AdminContextView view;
private final Session session;
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-07-31 13:28:16 UTC (rev 822)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/ctx/admin/ui/AdminContextPanel.java 2008-08-01 10:53:22 UTC (rev 823)
@@ -21,10 +21,8 @@
package org.ourproject.kune.docs.client.ctx.admin.ui;
import java.util.Date;
-import java.util.Iterator;
import java.util.List;
-import org.ourproject.kune.docs.client.actions.DocsEvents;
import org.ourproject.kune.docs.client.ctx.admin.AdminContextPresenter;
import org.ourproject.kune.docs.client.ctx.admin.AdminContextView;
import org.ourproject.kune.platf.client.dto.AccessListsDTO;
@@ -32,232 +30,230 @@
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.ui.IconLabel;
-import org.ourproject.kune.platf.client.ui.stacks.IndexedStackPanelWithSubItems;
-import org.ourproject.kune.platf.client.ui.stacks.StackSubItemAction;
-import org.ourproject.kune.workspace.client.WorkspaceFactory;
-import org.ourproject.kune.workspace.client.i18n.LanguageSelectorComponent;
-import org.ourproject.kune.workspace.client.i18n.ui.LanguageSelectorPanel;
-import org.ourproject.kune.workspace.client.ui.ctx.admin.AccessListsPanel;
-import com.google.gwt.user.client.ui.ClickListener;
import com.google.gwt.user.client.ui.VerticalPanel;
-import com.google.gwt.user.client.ui.Widget;
-import com.gwtext.client.data.Record;
-import com.gwtext.client.widgets.form.ComboBox;
-import com.gwtext.client.widgets.form.DateField;
-import com.gwtext.client.widgets.form.Field;
import com.gwtext.client.widgets.form.FormPanel;
-import com.gwtext.client.widgets.form.TextArea;
-import com.gwtext.client.widgets.form.event.ComboBoxListenerAdapter;
-import com.gwtext.client.widgets.form.event.FieldListenerAdapter;
public class AdminContextPanel extends VerticalPanel implements AdminContextView {
private static final Images IMG = Images.App.getInstance();
private static final int FORMS_WIDTH = 145;
- private final IndexedStackPanelWithSubItems options;
- private final AdminContextPresenter presenter;
- private AccessListsPanel accessListsPanel;
- private DateField publishedOnField;
- private TextArea tagsField;
- private VerticalPanel tagsComponent;
- private VerticalPanel publishedOnComponent;
- private LanguageSelectorComponent langPresenter;
- 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;
+ // private final IndexedStackPanelWithSubItems options;
+ // private final AdminContextPresenter presenter;
+ //
+ // private AccessListsPanel accessListsPanel;
+ // private DateField publishedOnField;
+ // private TextArea tagsField;
+ // private VerticalPanel tagsComponent;
+ // private VerticalPanel publishedOnComponent;
+ // private LanguageSelectorComponent langPresenter;
+ // 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, final I18nTranslationService i18n) {
- this.presenter = presenter;
- this.i18n = i18n;
- options = new IndexedStackPanelWithSubItems();
- options.addStyleName("kune-AdminContextPanel");
-
- 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");
+ // this.presenter = presenter;
+ // this.i18n = i18n;
+ // //options = new IndexedStackPanelWithSubItems();
+ // //options.addStyleName("kune-AdminContextPanel");
+ //
+ // //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(i18n);
- }
- if (!options.containsItem(perms_item)) {
- addComponent(perms_item, 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(), 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);
+ // 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, 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, 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, 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();
+ // private VerticalPanel createPublicationComponent() {
+ // // final FormPanel form = createDefaultForm();
+ // //
+ // // 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);
+ // // }
+ // // });
+ // //
+ // // form.add(publishedOnField);
+ // //
+ // // 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);
+ // }
+ // });
+ //
+ // form.add(tagsField);
+ // final VerticalPanel vp = new VerticalPanel();
+ // vp.add(form);
+ // return vp;
+ // }
- 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);
- }
- });
-
- form.add(publishedOnField);
-
- 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);
- }
- });
-
- 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);
}
}
Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/AbstractPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/AbstractPresenter.java 2008-07-31 13:28:16 UTC (rev 822)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/AbstractPresenter.java 2008-08-01 10:53:22 UTC (rev 823)
@@ -1,34 +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 org.ourproject.kune.platf.client.dispatch.DefaultDispatcher;
-
-public abstract class AbstractPresenter {
-
- public void doAction(final String action, final Object value) {
- DefaultDispatcher.getInstance().fire(action, value);
- }
-
- public void doGoto(final String token) {
- DefaultDispatcher.getInstance().fire(PlatformEvents.GOTO, token);
- }
-
-}
Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/PlatformClientModule.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/PlatformClientModule.java 2008-07-31 13:28:16 UTC (rev 822)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/PlatformClientModule.java 2008-08-01 10:53:22 UTC (rev 823)
@@ -1,45 +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 org.ourproject.kune.platf.client.actions.GotoAction;
-import org.ourproject.kune.platf.client.actions.GotoContainerAction;
-import org.ourproject.kune.platf.client.extend.ClientModule;
-import org.ourproject.kune.platf.client.extend.Register;
-import org.ourproject.kune.platf.client.state.Session;
-import org.ourproject.kune.platf.client.state.StateManager;
-
-import com.calclab.suco.client.container.Provider;
-
-public class PlatformClientModule implements ClientModule {
- private final Provider<StateManager> stateManager;
- private final Session session;
-
- public PlatformClientModule(final Session session, final Provider<StateManager> provider) {
- this.stateManager = provider;
- this.session = session;
- }
-
- public void configure(final Register register) {
- register.addAction(PlatformEvents.GOTO, new GotoAction(stateManager));
- register.addAction(PlatformEvents.GOTO_CONTAINER, new GotoContainerAction(stateManager, session));
- }
-}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/PlatformEvents.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/PlatformEvents.java 2008-07-31 13:28:16 UTC (rev 822)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/PlatformEvents.java 2008-08-01 10:53:22 UTC (rev 823)
@@ -23,6 +23,4 @@
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";
- public static final String GOTO = "ws.Goto";
- public static final String GOTO_CONTAINER = "ws.GotoContainer";
}
Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/actions/GotoAction.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/GotoAction.java 2008-07-31 13:28:16 UTC (rev 822)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/GotoAction.java 2008-08-01 10:53:22 UTC (rev 823)
@@ -1,43 +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.actions;
-
-import org.ourproject.kune.platf.client.dispatch.Action;
-import org.ourproject.kune.platf.client.dto.StateToken;
-import org.ourproject.kune.platf.client.state.StateManager;
-
-import com.calclab.suco.client.container.Provider;
-
-public class GotoAction implements Action<String> {
-
- private final Provider<StateManager> stateManager;
-
- public GotoAction(final Provider<StateManager> stateManager) {
- this.stateManager = stateManager;
- }
-
- public void execute(final String value) {
- onGoto(value);
- }
-
- private void onGoto(final String token) {
- stateManager.get().setState(new StateToken(token));
- }
-}
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-07-31 13:28:16 UTC (rev 822)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/app/ApplicationDefault.java 2008-08-01 10:53:22 UTC (rev 823)
@@ -28,17 +28,14 @@
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.extend.ExtensibleWidgetsManager;
import org.ourproject.kune.platf.client.rpc.SiteService;
import org.ourproject.kune.platf.client.rpc.SiteServiceAsync;
-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;
import org.ourproject.kune.platf.client.ui.WindowUtils;
import org.ourproject.kune.platf.client.utils.PrefetchUtilities;
-import org.ourproject.kune.workspace.client.WorkspaceFactory;
import org.ourproject.kune.workspace.client.sitebar.Site;
import org.ourproject.kune.workspace.client.ui.newtmp.skel.WorkspaceSkeleton;
import org.ourproject.kune.workspace.client.workspace.Workspace;
@@ -52,17 +49,17 @@
import com.google.gwt.user.client.rpc.AsyncCallback;
public class ApplicationDefault implements Application {
- private final Workspace workspace;
+ // private final Workspace workspace;
private Map<String, ClientTool> tools;
private final Session session;
private final Signal<Object> onApplicationStart;
private final Signal<Object> onApplicationStop;
private StateManager stateManager;
- public ApplicationDefault(final Session session, final ExtensibleWidgetsManager extensionPointManager,
- final I18nTranslationService i18n, final KuneErrorHandler errorHandler, final WorkspaceSkeleton ws) {
+ public ApplicationDefault(final Session session, final KuneErrorHandler errorHandler, final WorkspaceSkeleton ws) {
this.session = session;
- workspace = WorkspaceFactory.createWorkspace(session, extensionPointManager, i18n, errorHandler);
+ // workspace = WorkspaceFactory.createWorkspace(session,
+ // extensionPointManager, i18n, errorHandler);
tools = new HashMap<String, ClientTool>();
this.onApplicationStart = new Signal<Object>("onApplicationStart");
this.onApplicationStop = new Signal<Object>("onApplicationStop");
@@ -81,8 +78,9 @@
return tools.get(toolName);
}
+ @Deprecated
public Workspace getWorkspace() {
- return workspace;
+ return null;
}
public void init(final StateManager stateManager, final HashMap<String, ClientTool> tools) {
@@ -112,7 +110,7 @@
getInitData();
final Timer prefetchTimer = new Timer() {
public void run() {
- PrefetchUtilities.doTasksDeferred(workspace);
+ PrefetchUtilities.doTasksDeferred();
}
};
prefetchTimer.schedule(20000);
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-07-31 13:28:16 UTC (rev 822)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneErrorHandler.java 2008-08-01 10:53:22 UTC (rev 823)
@@ -19,8 +19,6 @@
*/
package org.ourproject.kune.platf.client.services;
-import org.ourproject.kune.platf.client.PlatformEvents;
-import org.ourproject.kune.platf.client.dispatch.DefaultDispatcher;
import org.ourproject.kune.platf.client.errors.AccessViolationException;
import org.ourproject.kune.platf.client.errors.AlreadyGroupMemberException;
import org.ourproject.kune.platf.client.errors.AlreadyUserMemberException;
@@ -30,6 +28,7 @@
import org.ourproject.kune.platf.client.errors.SessionExpiredException;
import org.ourproject.kune.platf.client.errors.UserMustBeLoggedException;
import org.ourproject.kune.platf.client.state.Session;
+import org.ourproject.kune.platf.client.state.StateManager;
import org.ourproject.kune.workspace.client.sitebar.Site;
import org.ourproject.kune.workspace.client.ui.newtmp.skel.WorkspaceSkeleton;
@@ -44,12 +43,14 @@
private final I18nTranslationService i18n;
private final Provider<WorkspaceSkeleton> wsProvider;
private final Signal<Object> onSessionExpired;
+ private final Provider<StateManager> stateManagerProvider;
public KuneErrorHandler(final Session session, final I18nTranslationService i18n,
- final Provider<WorkspaceSkeleton> wsProvider) {
+ final Provider<WorkspaceSkeleton> wsProvider, final Provider<StateManager> stateManagerProvider) {
this.session = session;
this.i18n = i18n;
this.wsProvider = wsProvider;
+ this.stateManagerProvider = stateManagerProvider;
this.onSessionExpired = new Signal<Object>("onSessionExpired");
}
@@ -81,11 +82,11 @@
} catch (final GroupNotFoundException e) {
logException(e);
Site.error(i18n.t("Group not found"));
- DefaultDispatcher.getInstance().fire(PlatformEvents.GOTO, "");
+ stateManagerProvider.get().gotoToken("");
} catch (final ContentNotFoundException e) {
logException(e);
Site.error(i18n.t("Content not found"));
- DefaultDispatcher.getInstance().fire(PlatformEvents.GOTO, "");
+ stateManagerProvider.get().gotoToken("");
} catch (final LastAdminInGroupException e) {
logException(e);
getWorkspaceSkeleton().showAlertMessage(
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-07-31 13:28:16 UTC (rev 822)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneModule.java 2008-08-01 10:53:22 UTC (rev 823)
@@ -3,13 +3,11 @@
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.PlatformClientModule;
import org.ourproject.kune.platf.client.app.Application;
import org.ourproject.kune.platf.client.app.ApplicationDefault;
import org.ourproject.kune.platf.client.app.HistoryWrapper;
import org.ourproject.kune.platf.client.app.HistoryWrapperImpl;
import org.ourproject.kune.platf.client.dto.StateToken;
-import org.ourproject.kune.platf.client.extend.ExtensibleWidgetsManager;
import org.ourproject.kune.platf.client.rpc.AsyncCallbackSimple;
import org.ourproject.kune.platf.client.rpc.ContentService;
import org.ourproject.kune.platf.client.rpc.ContentServiceAsync;
@@ -74,7 +72,6 @@
import org.ourproject.kune.workspace.client.summary.GroupSummaryView;
import org.ourproject.kune.workspace.client.tags.TagsSummaryPanel;
import org.ourproject.kune.workspace.client.tags.TagsSummaryPresenter;
-import org.ourproject.kune.workspace.client.ui.newtmp.WorkspaceManager;
import org.ourproject.kune.workspace.client.ui.newtmp.licensefoot.EntityLicensePanel;
import org.ourproject.kune.workspace.client.ui.newtmp.licensefoot.EntityLicensePresenter;
import org.ourproject.kune.workspace.client.ui.newtmp.sitebar.sitelogo.SiteLogo;
@@ -119,6 +116,7 @@
import org.ourproject.kune.workspace.client.workspace.UserLiveSearcher;
import org.ourproject.kune.workspace.client.workspace.ui.EntityLogo;
import org.ourproject.kune.workspace.client.workspace.ui.EntityLogoPanel;
+import org.ourproject.kune.workspace.client.workspace.ui.EntityLogoPresenter;
import com.calclab.emiteuimodule.client.EmiteUIModule;
import com.calclab.suco.client.container.Container;
@@ -149,27 +147,19 @@
public Session create() {
return new SessionImpl(Cookies.getCookie(Site.USERHASH), $p(UserServiceAsync.class));
}
- });
-
- /** Services (this in other module after UI refactor * */
-
- register(SingletonScope.class, new Factory<I18nServiceAsync>(I18nServiceAsync.class) {
+ }, new Factory<I18nServiceAsync>(I18nServiceAsync.class) {
public I18nServiceAsync create() {
final I18nServiceAsync service = (I18nServiceAsync) GWT.create(I18nService.class);
((ServiceDefTarget) service).setServiceEntryPoint(GWT.getModuleBaseURL() + "I18nService");
return service;
}
- });
-
- register(SingletonScope.class, new Factory<UserServiceAsync>(UserServiceAsync.class) {
+ }, new Factory<UserServiceAsync>(UserServiceAsync.class) {
public UserServiceAsync create() {
final UserServiceAsync service = (UserServiceAsync) GWT.create(UserService.class);
((ServiceDefTarget) service).setServiceEntryPoint(GWT.getModuleBaseURL() + "UserService");
return service;
}
- });
-
- register(SingletonScope.class, new Factory<SocialNetworkServiceAsync>(SocialNetworkServiceAsync.class) {
+ }, new Factory<SocialNetworkServiceAsync>(SocialNetworkServiceAsync.class) {
public SocialNetworkServiceAsync create() {
final SocialNetworkServiceAsync snServiceAsync = (SocialNetworkServiceAsync) GWT
.create(SocialNetworkService.class);
@@ -177,18 +167,15 @@
+ "SocialNetworkService");
return snServiceAsync;
}
- });
-
- register(SingletonScope.class, new Factory<GroupServiceAsync>(GroupServiceAsync.class) {
+ }, new Factory<GroupServiceAsync>(GroupServiceAsync.class) {
public GroupServiceAsync create() {
final GroupServiceAsync groupServiceAsync = (GroupServiceAsync) GWT.create(GroupService.class);
((ServiceDefTarget) groupServiceAsync).setServiceEntryPoint(GWT.getModuleBaseURL() + "GroupService");
return groupServiceAsync;
}
- });
-
- register(SingletonScope.class, new Factory<ContentServiceAsync>(ContentServiceAsync.class) {
+ }, new Factory<ContentServiceAsync>(ContentServiceAsync.class) {
public ContentServiceAsync create() {
+ // FIXME
return ContentService.App.getInstance();
}
});
@@ -225,35 +212,26 @@
$(QuickTipsHelper.class);
- register(SingletonScope.class, new Factory<UserServiceAsync>(UserServiceAsync.class) {
- public UserServiceAsync create() {
- final UserServiceAsync service = (UserServiceAsync) GWT.create(UserService.class);
- ((ServiceDefTarget) service).setServiceEntryPoint(GWT.getModuleBaseURL() + "UserService");
- return service;
+ register(SingletonScope.class, new Factory<HistoryWrapper>(HistoryWrapper.class) {
+ public HistoryWrapper create() {
+ return new HistoryWrapperImpl();
}
- });
-
- register(SingletonScope.class, new Factory<SocialNetworkServiceAsync>(SocialNetworkServiceAsync.class) {
- public SocialNetworkServiceAsync create() {
- final SocialNetworkServiceAsync snServiceAsync = (SocialNetworkServiceAsync) GWT
- .create(SocialNetworkService.class);
- ((ServiceDefTarget) snServiceAsync).setServiceEntryPoint(GWT.getModuleBaseURL()
- + "SocialNetworkService");
- return snServiceAsync;
+ }, new Factory<ContentProvider>(ContentProvider.class) {
+ public ContentProvider create() {
+ return new ContentProviderImpl($(ContentServiceAsync.class));
}
- });
-
- register(SingletonScope.class, new Factory<GroupServiceAsync>(GroupServiceAsync.class) {
- public GroupServiceAsync create() {
- final GroupServiceAsync groupServiceAsync = (GroupServiceAsync) GWT.create(GroupService.class);
- ((ServiceDefTarget) groupServiceAsync).setServiceEntryPoint(GWT.getModuleBaseURL() + "GroupService");
- return groupServiceAsync;
+ }, new Factory<StateManager>(StateManager.class) {
+ public StateManager create() {
+ final StateManagerDefault stateManager = new StateManagerDefault($(ContentProvider.class),
+ $(Session.class), $(HistoryWrapper.class));
+ History.addHistoryListener(stateManager);
+ return stateManager;
}
});
- register(SingletonScope.class, new Factory<ContentServiceAsync>(ContentServiceAsync.class) {
- public ContentServiceAsync create() {
- return ContentService.App.getInstance();
+ register(SingletonScope.class, new Factory<KuneErrorHandler>(KuneErrorHandler.class) {
+ public KuneErrorHandler create() {
+ return new KuneErrorHandler($(Session.class), i18n, $p(WorkspaceSkeleton.class), $p(StateManager.class));
}
});
@@ -261,20 +239,12 @@
public Images create() {
return Images.App.getInstance();
}
- });
-
- register(SingletonScope.class, new Factory<ImageUtils>(ImageUtils.class) {
+ }, new Factory<ImageUtils>(ImageUtils.class) {
public ImageUtils create() {
return new ImageUtils();
}
});
- register(SingletonScope.class, new Factory<KuneErrorHandler>(KuneErrorHandler.class) {
- public KuneErrorHandler create() {
- return new KuneErrorHandler($(Session.class), i18n, $p(WorkspaceSkeleton.class));
- }
- });
-
register(SingletonScope.class, new Factory<WorkspaceSkeleton>(WorkspaceSkeleton.class) {
public WorkspaceSkeleton create() {
return new WorkspaceSkeleton();
@@ -290,26 +260,19 @@
}
});
- register(SingletonScope.class, new Factory<ExtensibleWidgetsManager>(ExtensibleWidgetsManager.class) {
- public ExtensibleWidgetsManager create() {
- return new ExtensibleWidgetsManager();
- }
- });
-
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);
- final ExtensibleWidgetsManager extensionPointManager = $(ExtensibleWidgetsManager.class);
- return new ApplicationDefault(session, extensionPointManager, i18n, $(KuneErrorHandler.class), ws);
+ return new ApplicationDefault(session, $(KuneErrorHandler.class), ws);
}
});
register(SingletonScope.class, new Factory<SitePublicSpaceLink>(SitePublicSpaceLink.class) {
public SitePublicSpaceLink create() {
- final SitePublicSpaceLinkPresenter presenter = new SitePublicSpaceLinkPresenter();
+ final SitePublicSpaceLinkPresenter presenter = new SitePublicSpaceLinkPresenter($(StateManager.class));
final SitePublicSpaceLinkPanel panel = new SitePublicSpaceLinkPanel(presenter, ws, i18n, images);
presenter.init(panel);
return presenter;
@@ -400,7 +363,7 @@
register(SingletonScope.class, new Factory<SiteSearcher>(SiteSearcher.class) {
public SiteSearcher create() {
- final SiteSearcherPresenter presenter = new SiteSearcherPresenter();
+ final SiteSearcherPresenter presenter = new SiteSearcherPresenter($p(StateManager.class));
final SiteSearcherView view = new SiteSearcherPanel(presenter, i18n, ws);
presenter.init(view);
return presenter;
@@ -455,24 +418,20 @@
}
});
- $(SitePublicSpaceLink.class);
- $(SiteMessage.class);
- $(SiteUserMenu.class);
- $(SiteSignInLink.class);
- $(SiteSignOutLink.class);
- $(SiteNewGroupLink.class);
- $(SiteSearch.class);
- $(SiteLogo.class);
-
register(SingletonScope.class, new Factory<EntityLogo>(EntityLogo.class) {
public EntityLogo create() {
- return new EntityLogoPanel(i18n, ws);
+ final EntityLogoPresenter presenter = new EntityLogoPresenter($(StateManager.class),
+ $(WsThemePresenter.class));
+ final EntityLogoPanel panel = new EntityLogoPanel(i18n, ws);
+ presenter.init(panel);
+ return presenter;
}
});
register(SingletonScope.class, new Factory<WsThemePresenter>(WsThemePresenter.class) {
public WsThemePresenter create() {
- final WsThemePresenter presenter = new WsThemePresenter($(Session.class), $p(GroupServiceAsync.class));
+ final WsThemePresenter presenter = new WsThemePresenter($(Session.class), $p(GroupServiceAsync.class),
+ $(StateManager.class));
final WsThemePanel panel = new WsThemePanel(ws, presenter, i18n);
presenter.init(panel);
return presenter;
@@ -481,7 +440,8 @@
register(SingletonScope.class, new Factory<EntityTitlePresenter>(EntityTitlePresenter.class) {
public EntityTitlePresenter create() {
- final EntityTitlePresenter presenter = new EntityTitlePresenter(i18n, $(KuneErrorHandler.class));
+ final EntityTitlePresenter presenter = new EntityTitlePresenter(i18n, $(KuneErrorHandler.class),
+ $(StateManager.class));
final EntityTitlePanel panel = new EntityTitlePanel(ws, presenter);
presenter.init(panel);
return presenter;
@@ -490,7 +450,7 @@
register(SingletonScope.class, new Factory<EntitySubTitlePresenter>(EntitySubTitlePresenter.class) {
public EntitySubTitlePresenter create() {
- final EntitySubTitlePresenter presenter = new EntitySubTitlePresenter(i18n);
+ final EntitySubTitlePresenter presenter = new EntitySubTitlePresenter(i18n, $(StateManager.class));
final EntitySubTitlePanel panel = new EntitySubTitlePanel(presenter, i18n, ws);
presenter.init(panel);
return presenter;
@@ -499,7 +459,7 @@
register(SingletonScope.class, new Factory<EntityLicensePresenter>(EntityLicensePresenter.class) {
public EntityLicensePresenter create() {
- final EntityLicensePresenter presenter = new EntityLicensePresenter();
+ final EntityLicensePresenter presenter = new EntityLicensePresenter($(StateManager.class));
final EntityLicensePanel panel = new EntityLicensePanel(presenter, i18n, ws);
presenter.init(panel);
return presenter;
@@ -508,7 +468,7 @@
register(SingletonScope.class, new Factory<RatePresenter>(RatePresenter.class) {
public RatePresenter create() {
- final RatePresenter presenter = new RatePresenter();
+ final RatePresenter presenter = new RatePresenter($(StateManager.class));
final RatePanel panel = new RatePanel(null, null, i18n, ws);
presenter.init(panel);
return presenter;
@@ -518,7 +478,7 @@
register(SingletonScope.class, new Factory<RateIt>(RateIt.class) {
public RateIt create() {
final RateItPresenter presenter = new RateItPresenter(i18n, $(Session.class),
- $p(ContentServiceAsync.class), $p(StateManager.class));
+ $p(ContentServiceAsync.class), $(StateManager.class));
final RateItPanel panel = new RateItPanel(presenter, i18n, ws);
presenter.init(panel);
return presenter;
@@ -528,8 +488,8 @@
register(SingletonScope.class, new Factory<GroupMembersSummary>(GroupMembersSummary.class) {
public GroupMembersSummary create() {
final GroupMembersSummaryPresenter presenter = new GroupMembersSummaryPresenter(i18n,
- $p(StateManager.class), $(ImageUtils.class), $(Session.class),
- $p(SocialNetworkServiceAsync.class), $p(UserLiveSearcher.class));
+ $(StateManager.class), $(ImageUtils.class), $(Session.class),
+ $p(SocialNetworkServiceAsync.class), $p(UserLiveSearcher.class), $(WsThemePresenter.class));
final GroupMembersSummaryView view = new GroupMembersSummaryPanel(presenter, i18n, ws);
presenter.init(view);
return presenter;
@@ -538,7 +498,8 @@
register(SingletonScope.class, new Factory<GroupSummary>(GroupSummary.class) {
public GroupSummary create() {
- final GroupSummaryPresenter presenter = new GroupSummaryPresenter();
+ final GroupSummaryPresenter presenter = new GroupSummaryPresenter($(StateManager.class),
+ $(WsThemePresenter.class));
final GroupSummaryView view = new GroupSummaryPanel(presenter, i18n, ws);
presenter.init(view);
return presenter;
@@ -548,8 +509,8 @@
register(SingletonScope.class, new Factory<ParticipationSummary>(ParticipationSummary.class) {
public ParticipationSummary create() {
final ParticipationSummaryPresenter presenter = new ParticipationSummaryPresenter(i18n,
- $p(StateManager.class), $(ImageUtils.class), $(Session.class),
- $p(SocialNetworkServiceAsync.class));
+ $(StateManager.class), $(ImageUtils.class), $(Session.class),
+ $p(SocialNetworkServiceAsync.class), $(WsThemePresenter.class));
final ParticipationSummaryView view = new ParticipationSummaryPanel(presenter, i18n, ws);
presenter.init(view);
return presenter;
@@ -559,43 +520,13 @@
register(SingletonScope.class, new Factory<TagsSummary>(TagsSummary.class) {
public TagsSummary create() {
final TagsSummaryPresenter presenter = new TagsSummaryPresenter($p(Session.class),
- $p(SiteSearcher.class));
+ $p(SiteSearcher.class), $(StateManager.class), $(WsThemePresenter.class));
final TagsSummaryPanel panel = new TagsSummaryPanel(presenter, i18n, ws);
presenter.init(panel);
return presenter;
}
});
- register(SingletonScope.class, new Factory<WorkspaceManager>(WorkspaceManager.class) {
- public WorkspaceManager create() {
- final WorkspaceManager presenter = new WorkspaceManager($(SitePublicSpaceLink.class),
- $(EntityLogo.class), $(EntityTitlePresenter.class), $(EntitySubTitlePresenter.class),
- $(WsThemePresenter.class), $(EntityLicensePresenter.class), $p(GroupMembersSummary.class),
- $p(ParticipationSummary.class), $p(TagsSummary.class), $p(GroupSummary.class),
- $p(RateIt.class), $p(RatePresenter.class));
- return presenter;
- }
- });
-
- $(WorkspaceManager.class);
-
- register(SingletonScope.class, new Factory<HistoryWrapper>(HistoryWrapper.class) {
- public HistoryWrapper create() {
- return new HistoryWrapperImpl();
- }
- }, new Factory<ContentProvider>(ContentProvider.class) {
- public ContentProvider create() {
- return new ContentProviderImpl($(ContentServiceAsync.class));
- }
- }, new Factory<StateManager>(StateManager.class) {
- public StateManager create() {
- final StateManagerDefault stateManager = new StateManagerDefault($(ContentProvider.class),
- $(Session.class), $(HistoryWrapper.class), $(WorkspaceManager.class));
- History.addHistoryListener(stateManager);
- return stateManager;
- }
- });
-
register(SingletonScope.class, new Factory<UserLiveSearcher>(UserLiveSearcher.class) {
public UserLiveSearcher create() {
final UserLiveSearcherPresenter presenter = new UserLiveSearcherPresenter();
@@ -616,6 +547,28 @@
load(new EmiteUIModule(), new DocumentClientNewModule(), new ChatClientNewModule());
+ $(SitePublicSpaceLink.class);
+ $(SiteMessage.class);
+ $(SiteUserMenu.class);
+ $(SiteSignInLink.class);
+ $(SiteSignOutLink.class);
+ $(SiteNewGroupLink.class);
+ $(SiteSearch.class);
+ $(SiteLogo.class);
+
+ $(EntityLogo.class);
+ $(EntityTitlePresenter.class);
+ $(EntitySubTitlePresenter.class);
+ $(WsThemePresenter.class);
+ $(EntityLicensePresenter.class);
+ $(RateIt.class);
+ $(RatePresenter.class);
+
+ $(GroupMembersSummary.class);
+ $(ParticipationSummary.class);
+ $(TagsSummary.class);
+ $(GroupSummary.class);
+
// Register of tokens like "signin", "newgroup", "translate" etcetera
$(StateManager.class).addSiteToken(SiteToken.signin.toString(), new Slot<StateToken>() {
public void onEvent(final StateToken previousStateToken) {
@@ -630,12 +583,11 @@
});
final KunePlatform platform = $(KunePlatform.class);
- platform.install(new PlatformClientModule($(Session.class), $p(StateManager.class)));
platform.install(new WorkspaceClientModule($(Session.class), $(StateManager.class), $(Application.class)
.getWorkspace(), i18n));
$(Application.class).init($(StateManager.class), platform.getIndexedTools());
$(Application.class).subscribeActions(platform.getActions());
- $(Application.class).getWorkspace().attachTools(platform.getTools().iterator());
+ // $(Application.class).getWorkspace().attachTools(platform.getTools().iterator());
$(Application.class).start();
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/state/StateManager.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/state/StateManager.java 2008-07-31 13:28:16 UTC (rev 822)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/state/StateManager.java 2008-08-01 10:53:22 UTC (rev 823)
@@ -31,8 +31,14 @@
void addSiteToken(String token, Slot<StateToken> whenToken);
+ void gotoContainer(Long containerId);
+
void gotoToken(String token);
+ void onSocialNetworkChanged(Slot<StateDTO> slot);
+
+ void onStateChanged(Slot<StateDTO> slot);
+
void reload();
void reloadContextAndTitles();
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/state/StateManagerDefault.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/state/StateManagerDefault.java 2008-07-31 13:28:16 UTC (rev 822)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/state/StateManagerDefault.java 2008-08-01 10:53:22 UTC (rev 823)
@@ -31,9 +31,9 @@
import org.ourproject.kune.platf.client.dto.UserInfoDTO;
import org.ourproject.kune.platf.client.rpc.AsyncCallbackSimple;
import org.ourproject.kune.workspace.client.sitebar.Site;
-import org.ourproject.kune.workspace.client.ui.newtmp.WorkspaceManager;
import com.allen_sauer.gwt.log.client.Log;
+import com.calclab.suco.client.signal.Signal;
import com.calclab.suco.client.signal.Slot;
public class StateManagerDefault implements StateManager {
@@ -41,16 +41,18 @@
private StateDTO oldState;
private final Session session;
private final HistoryWrapper history;
- private final WorkspaceManager workspaceManager;
private final HashMap<String, Slot<StateToken>> siteTokens;
+ private final Signal<StateDTO> onStateChanged;
+ private final Signal<StateDTO> onSocialNetworkChanged;
public StateManagerDefault(final ContentProvider contentProvider, final Session session,
- final HistoryWrapper history, final WorkspaceManager workspaceManager) {
+ final HistoryWrapper history) {
this.contentProvider = contentProvider;
this.session = session;
this.history = history;
- this.workspaceManager = workspaceManager;
this.oldState = null;
+ this.onStateChanged = new Signal<StateDTO>("onStateChanged");
+ this.onSocialNetworkChanged = new Signal<StateDTO>("onSocialNetworkChanged");
session.onUserSignIn(new Slot<UserInfoDTO>() {
public void onEvent(final UserInfoDTO parameter) {
restorePreviousState();
@@ -68,6 +70,13 @@
siteTokens.put(token, slot);
}
+ public void gotoContainer(final Long containerId) {
+ final StateToken newStateToken = session.getCurrentState().getStateToken();
+ newStateToken.setDocument(null);
+ newStateToken.setFolder(containerId.toString());
+ setState(newStateToken);
+ }
+
public void gotoToken(final String token) {
setState(new StateToken(token));
}
@@ -90,6 +99,14 @@
}
}
+ public void onSocialNetworkChanged(final Slot<StateDTO> slot) {
+ onSocialNetworkChanged.add(slot);
+ }
+
+ public void onStateChanged(final Slot<StateDTO> slot) {
+ onStateChanged.add(slot);
+ }
+
/**
* <p>
* Reload current state (using client cache if available)
@@ -132,7 +149,7 @@
final ParticipationDataDTO userParticipation = socialNet.getUserParticipation();
state.setGroupMembers(groupMembers);
state.setParticipation(userParticipation);
- workspaceManager.setSocialNetwork(state);
+ onSocialNetworkChanged.fire(state);
}
}
@@ -142,7 +159,7 @@
private void loadContent(final StateDTO state) {
session.setCurrent(state);
- workspaceManager.setState(state);
+ onStateChanged.fire(state);
// final GroupDTO group = state.getGroup();
// app.setGroupState(group.getShortName());
// final boolean isAdmin = state.getGroupRights().isAdministrable();
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/UnknowComponent.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/UnknowComponent.java 2008-07-31 13:28:16 UTC (rev 822)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/UnknowComponent.java 2008-08-01 10:53:22 UTC (rev 823)
@@ -29,7 +29,7 @@
public static final UnknowComponent instance = new UnknowComponent();
public UnknowComponent() {
- super("programming error: unknown component!! please contact kune_dev at ourproject.org");
+ super("programming error: unknown component!! please contact kune-devel at lists-ourproject.org");
}
public View getView() {
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rate/RateIt.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rate/RateIt.java 2008-07-31 13:28:16 UTC (rev 822)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rate/RateIt.java 2008-08-01 10:53:22 UTC (rev 823)
@@ -1,11 +1,8 @@
package org.ourproject.kune.platf.client.ui.rate;
-import org.ourproject.kune.platf.client.dto.StateDTO;
public interface RateIt {
- void setState(StateDTO state);
-
void setVisible(boolean visible);
}
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-07-31 13:28:16 UTC (rev 822)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rate/RateItPresenter.java 2008-08-01 10:53:22 UTC (rev 823)
@@ -28,6 +28,7 @@
import org.ourproject.kune.workspace.client.sitebar.Site;
import com.calclab.suco.client.container.Provider;
+import com.calclab.suco.client.signal.Slot;
public class RateItPresenter implements RateIt {
@@ -38,15 +39,19 @@
private final I18nTranslationService i18n;
private final Provider<ContentServiceAsync> contentServiceProvider;
private final Session session;
- private final Provider<StateManager> stateManagerProvider;
+ private final StateManager stateManager;
public RateItPresenter(final I18nTranslationService i18n, final Session session,
- final Provider<ContentServiceAsync> contentServiceProvider,
- final Provider<StateManager> stateManagerProvider) {
+ final Provider<ContentServiceAsync> contentServiceProvider, final StateManager stateManager) {
this.i18n = i18n;
this.session = session;
this.contentServiceProvider = contentServiceProvider;
- this.stateManagerProvider = stateManagerProvider;
+ this.stateManager = stateManager;
+ stateManager.onStateChanged(new Slot<StateDTO>() {
+ public void onEvent(final StateDTO state) {
+ setState(state);
+ }
+ });
}
public void init(final RateItView view) {
@@ -64,19 +69,6 @@
setRatePanel(currentRate);
}
- public void setState(final StateDTO state) {
- if (state.isRateable()) {
- if (session.isLogged()) {
- setRate(state.getCurrentUserRate());
- view.setVisible(true);
- } else {
- view.setVisible(false);
- }
- } else {
- view.setVisible(false);
- }
- }
-
public void setVisible(final boolean visible) {
view.setVisible(visible);
}
@@ -98,7 +90,7 @@
public void onSuccess(final Object result) {
Site.hideProgress();
Site.info(i18n.t("Content rated"));
- stateManagerProvider.get().reload();
+ stateManager.reload();
}
});
}
@@ -140,4 +132,17 @@
setDesc((int) Math.ceil(value.doubleValue()));
}
}
+
+ private void setState(final StateDTO state) {
+ if (state.isRateable()) {
+ if (session.isLogged()) {
+ setRate(state.getCurrentUserRate());
+ view.setVisible(true);
+ } else {
+ view.setVisible(false);
+ }
+ } else {
+ view.setVisible(false);
+ }
+ }
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rate/RatePresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rate/RatePresenter.java 2008-07-31 13:28:16 UTC (rev 822)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rate/RatePresenter.java 2008-08-01 10:53:22 UTC (rev 823)
@@ -1,19 +1,31 @@
package org.ourproject.kune.platf.client.ui.rate;
import org.ourproject.kune.platf.client.dto.StateDTO;
+import org.ourproject.kune.platf.client.state.StateManager;
+import com.calclab.suco.client.signal.Slot;
+
public class RatePresenter {
private RateView view;
- public RatePresenter() {
+ public RatePresenter(final StateManager stateManager) {
+ stateManager.onStateChanged(new Slot<StateDTO>() {
+ public void onEvent(final StateDTO state) {
+ setState(state);
+ }
+ });
}
public void init(final RateView view) {
this.view = view;
}
- public void setState(final StateDTO state) {
+ public void setVisible(final boolean visible) {
+ view.setVisible(visible);
+ }
+
+ private void setState(final StateDTO state) {
if (state.isRateable()) {
view.setVisible(true);
view.setRate(state.getRate());
@@ -23,8 +35,4 @@
}
}
-
- public void setVisible(final boolean visible) {
- view.setVisible(visible);
- }
}
Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/ui/stacks/IndexedStackPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/stacks/IndexedStackPanel.java 2008-07-31 13:28:16 UTC (rev 822)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/stacks/IndexedStackPanel.java 2008-08-01 10:53:22 UTC (rev 823)
@@ -1,195 +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.ui.stacks;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-
-import org.ourproject.kune.platf.client.ui.AbstractLabel;
-import org.ourproject.kune.platf.client.ui.IconLabel;
-import org.ourproject.kune.platf.client.ui.KuneUiUtils;
-import org.ourproject.kune.platf.client.ui.LabelWrapper;
-import org.ourproject.kune.platf.client.ui.UIConstants;
-
-import com.google.gwt.user.client.ui.AbstractImagePrototype;
-import com.google.gwt.user.client.ui.ScrollPanel;
-import com.google.gwt.user.client.ui.StackPanel;
-import com.google.gwt.user.client.ui.VerticalPanel;
-
-public class IndexedStackPanel extends StackPanel {
- public class StackItem {
- private String text;
- private String title;
- private AbstractImagePrototype icon;
- private String iconAlign;
- private boolean countVisible;
- private final ArrayList<String> subItems;
-
- public StackItem(final String text, final String title, final AbstractImagePrototype icon,
- final String iconAlign, final boolean countVisible) {
- this.text = text;
- this.title = title;
- this.icon = icon;
- this.iconAlign = iconAlign;
- this.countVisible = countVisible;
- subItems = new ArrayList<String>();
- }
-
- public void addSubItem(final String name) {
- subItems.add(name);
- }
-
- public void clear() {
- subItems.clear();
- }
-
- public int getCount() {
- return subItems.size();
- }
-
- public String getHtml() {
- final boolean insertIcon = icon != null && iconAlign != null;
- final String textWithCount = text + (countVisible ? " (" + subItems.size() + ")" : "");
- AbstractLabel label;
- if (insertIcon) {
- if (iconAlign == UIConstants.ICON_HORIZ_ALIGN_RIGHT) {
- label = new IconLabel(textWithCount, icon);
- } else {
- label = new IconLabel(textWithCount, icon);
- }
- } else {
- label = new LabelWrapper(textWithCount);
- }
- KuneUiUtils.setQuickTip(label.getElement(), title);
- return label.toString();
- }
-
- public String getName() {
- return text;
- }
-
- public int indexOfSubItem(final String name) {
- return subItems.indexOf(name);
- }
-
- public boolean isCountVisible() {
- return countVisible;
- }
-
- public void removeSubItem(final String name) {
- subItems.remove(name);
- }
-
- public void setCountVisible(final boolean visible) {
- this.countVisible = visible;
- }
-
- public void setIcon(final AbstractImagePrototype icon) {
- this.icon = icon;
- }
-
- public void setIconAlign(final String iconAlign) {
- this.iconAlign = iconAlign;
- }
-
- public void setText(final String text) {
- this.text = text;
- }
-
- public void setTitle(final String title) {
- this.title = title;
- }
- }
-
- private final ArrayList<StackItem> stackList;
-
- /* Stack items */
-
- public IndexedStackPanel() {
- stackList = new ArrayList<StackItem>();
- }
-
- public VerticalPanel addStackItem(final String name, final String title, final AbstractImagePrototype icon,
- final String iconAlign, final boolean countVisible) {
- final ScrollPanel siSP = new ScrollPanel();
- final VerticalPanel siVP = new VerticalPanel();
- siSP.add(siVP);
- final StackItem stackItem = new StackItem(name, title, icon, iconAlign, countVisible);
- add(siSP, stackItem.getHtml(), true);
- stackList.add(stackItem);
- return siVP;
- }
-
- public VerticalPanel addStackItem(final String name, final String title, final boolean countVisible) {
- return addStackItem(name, title, null, null, countVisible);
- }
-
- public void clear() {
- for (final Iterator<StackItem> iterator = stackList.iterator(); iterator.hasNext();) {
- final StackItem item = iterator.next();
- item.clear();
- }
- stackList.clear();
- super.clear();
- }
-
- public boolean containsItem(final String name) {
- return indexOf(name) == -1 ? false : true;
- }
-
- public StackItem getItem(final int indexOfStackItem) {
- return stackList.get(indexOfStackItem);
- }
-
- public StackItem getItem(final String name) {
- return stackList.get(indexOf(name));
- }
-
- public int indexOf(final String name) {
- final Iterator<StackItem> iter = stackList.iterator();
- int i = 0;
- while (iter.hasNext()) {
- final StackItem stackItem = iter.next();
- if (stackItem.getName() == name) {
- return i;
- } else {
- i++;
- }
- }
- return -1;
- }
-
- public void removeStackItem(final String name) {
- final int idx = indexOf(name);
- remove(idx);
- stackList.remove(idx);
- }
-
- /*
- * Unattached stack item. We update the stack using this object and
- * generating the Html with getHtml
- */
-
- public void showStackItem(final String name) {
- final int idx = indexOf(name);
- showStack(idx);
- }
-
-}
Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/ui/stacks/IndexedStackPanelWithSubItems.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/stacks/IndexedStackPanelWithSubItems.java 2008-07-31 13:28:16 UTC (rev 822)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/stacks/IndexedStackPanelWithSubItems.java 2008-08-01 10:53:22 UTC (rev 823)
@@ -1,136 +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.ui.stacks;
-
-import org.ourproject.kune.platf.client.AbstractPresenter;
-import org.ourproject.kune.platf.client.ui.IconLabel;
-
-import com.google.gwt.user.client.Command;
-import com.google.gwt.user.client.ui.AbstractImagePrototype;
-import com.google.gwt.user.client.ui.MenuBar;
-import com.google.gwt.user.client.ui.ScrollPanel;
-import com.google.gwt.user.client.ui.VerticalPanel;
-
-public class IndexedStackPanelWithSubItems extends IndexedStackPanel {
-
- private static final int MAX_ELEMENTS_PER_STACKITEM = 5;
-
- public IndexedStackPanelWithSubItems() {
- }
-
- /* Stack subItems */
-
- public void addStackSubItem(final String parentItemName, final AbstractImagePrototype icon, final String name,
- final String title, final StackSubItemAction[] memberActions, final AbstractPresenter presenter) {
- StackSubItem stackSubItem = new StackSubItem(icon, name, title, memberActions, presenter);
- int indexOfStackItem = this.indexOf(parentItemName);
- ScrollPanel sp = (ScrollPanel) this.getWidget(indexOfStackItem);
- VerticalPanel vp = (VerticalPanel) sp.getWidget();
- vp.add(stackSubItem);
- StackItem stackItem = this.getItem(indexOfStackItem);
- stackItem.addSubItem(name);
- this.setStackText(indexOfStackItem, stackItem.getHtml(), true);
- updateScroll(indexOfStackItem, stackItem.getCount());
- }
-
- public void removeStackSubItem(final String parentItemName, final String name) {
- int indexOfStackItem = this.indexOf(parentItemName);
- int indexOfStackSubItem = this.getItem(indexOfStackItem).indexOfSubItem(name);
-
- ScrollPanel sp = (ScrollPanel) this.getWidget(indexOfStackItem);
- ((VerticalPanel) sp.getWidget()).remove(indexOfStackSubItem);
- StackItem stackItem = this.getItem(indexOfStackItem);
- stackItem.removeSubItem(name);
- this.setStackText(indexOfStackItem, stackItem.getHtml(), true);
- updateScroll(indexOfStackItem, stackItem.getCount());
- }
-
- public void clear() {
- super.clear();
- }
-
- private void updateScroll(final int member, final int count) {
- if (count > MAX_ELEMENTS_PER_STACKITEM) {
- this.getWidget(member).setHeight("6em");
- } else {
- this.getWidget(member).setHeight("100%");
- }
- }
-
- protected class StackSubItem extends MenuBar {
- private final MenuBar actions;
- private AbstractImagePrototype icon;
- private String name;
- private final AbstractPresenter presenter;
-
- public StackSubItem(final AbstractImagePrototype icon, final String name, final String title,
- final StackSubItemAction[] memberActions, final AbstractPresenter presenter) {
- super(false);
- this.icon = icon;
- this.name = name;
- this.presenter = presenter;
- IconLabel label = new IconLabel(icon, name);
- label.setTitle(title);
- actions = new MenuBar(true);
- addItem(label.toString(), true, actions);
- setAutoOpen(false);
- actions.setAutoOpen(true);
- setStyleName("kune-StackSubItemLabel");
- actions.setStyleName("kune-StackSubItemActions");
- for (int i = 0; i < memberActions.length; i++) {
- addAction(memberActions[i], name);
- }
- }
-
- public void setName(final String name) {
- this.name = name;
- setMenu();
- }
-
- public void setImage(final AbstractImagePrototype icon) {
- this.icon = icon;
- setMenu();
- }
-
- public void addAction(final StackSubItemAction memberAction, final String param) {
- String itemHtml = "";
- AbstractImagePrototype icon = memberAction.getIcon();
- if (icon != null) {
- itemHtml = icon.getHTML();
- }
- itemHtml += memberAction.getText();
- actions.addItem(itemHtml, true, createCommand(memberAction.getAction(), param));
- }
-
- private void setMenu() {
- String label = icon.getHTML() + name;
- getItems().get(0).setText(label);
- }
-
- private Command createCommand(final String action, final String param) {
- return new Command() {
- public void execute() {
- presenter.doAction(action, param);
- }
- };
- }
- }
-
-}
Deleted: 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-07-31 13:28:16 UTC (rev 822)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/stacks/StackSubItemAction.java 2008-08-01 10:53:22 UTC (rev 823)
@@ -1,46 +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.ui.stacks;
-
-import com.google.gwt.user.client.ui.AbstractImagePrototype;
-
-public class StackSubItemAction {
- private final AbstractImagePrototype icon;
- private final String text;
- private final String action;
-
- public StackSubItemAction(final AbstractImagePrototype icon, final String text, final String action) {
- this.icon = icon;
- this.text = text;
- this.action = action;
- }
-
- public String getAction() {
- return action;
- }
-
- public AbstractImagePrototype getIcon() {
- return icon;
- }
-
- public String getText() {
- return text;
- }
-}
Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/ui/stacks/StackedDropDownPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/stacks/StackedDropDownPanel.java 2008-07-31 13:28:16 UTC (rev 822)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/stacks/StackedDropDownPanel.java 2008-08-01 10:53:22 UTC (rev 823)
@@ -1,214 +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.ui.stacks;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-
-import org.ourproject.kune.platf.client.AbstractPresenter;
-import org.ourproject.kune.platf.client.ui.DropDownPanel;
-import org.ourproject.kune.platf.client.ui.IconLabel;
-import org.ourproject.kune.platf.client.ui.UIConstants;
-
-import com.google.gwt.user.client.ui.AbstractImagePrototype;
-import com.google.gwt.user.client.ui.ClickListener;
-import com.google.gwt.user.client.ui.HorizontalPanel;
-import com.google.gwt.user.client.ui.Label;
-import com.google.gwt.user.client.ui.VerticalPanel;
-import com.google.gwt.user.client.ui.Widget;
-
-public class StackedDropDownPanel extends DropDownPanel implements UIConstants {
- private final AbstractPresenter presenter;
- private final IndexedStackPanelWithSubItems stack;
- private final VerticalPanel bottomLinksVP;
- private final ArrayList<String> bottomLinksIndex;
- private String headerText;
- private String headerTitle;
- private int headerCount;
- private boolean headerCountVisible;
- private final VerticalPanel commentsVP;
- private final VerticalPanel generalVP;
-
- public StackedDropDownPanel(final AbstractPresenter presenter, final String borderColor, final String headerText,
- final String headerTitle, final boolean headerCountVisible) {
- this.presenter = presenter;
- this.headerText = headerText;
- this.headerTitle = headerTitle;
- this.headerCountVisible = headerCountVisible;
- this.headerCount = 0;
- generalVP = new VerticalPanel();
- commentsVP = new VerticalPanel();
- stack = new IndexedStackPanelWithSubItems();
- bottomLinksVP = new VerticalPanel();
- bottomLinksIndex = new ArrayList<String>();
-
- // Layout
- // generalVP.add(commentsVP);
- generalVP.add(stack);
- generalVP.add(bottomLinksVP);
- setContent(generalVP);
-
- // Set properties
- // super.setColor(borderColor);
- setContentVisible(false); // DropDown
- setHeaderText(headerText);
- setHeaderTitle(headerTitle);
- addStyleName("kune-StackedDropDownPanel");
- addStyleName("kune-Margin-Medium-t");
- stack.setStyleName("kune-StackedDropDownPanel");
- }
-
- /* Header */
-
- public void addBottomLink(final AbstractImagePrototype icon, final String text, final String title,
- final String action) {
- this.addBottomLink(icon, text, title, action, null);
- }
-
- public void addBottomLink(final AbstractImagePrototype icon, final String text, final String title,
- final String action, final Object value) {
- final IconLabel link = new IconLabel(icon, text);
- link.setTitle(title);
- bottomLinksVP.add(link);
- link.addStyleName("kune-StackedDropDownPanelLink");
- link.addClickListener(new ClickListener() {
- public void onClick(final Widget arg0) {
- presenter.doAction(action, value);
- }
- });
- bottomLinksVP.setCellHorizontalAlignment(link, HorizontalPanel.ALIGN_CENTER);
- bottomLinksIndex.add(text);
- }
-
- public void addComment(final String comment) {
- if (!commentsVP.isVisible()) {
- generalVP.insert(commentsVP, 0);
- commentsVP.setVisible(true);
- }
- final Label label = new Label(comment);
- commentsVP.add(label);
- label.addStyleName("kune-Margin-Small-trbl");
- }
-
- public void addStackItem(final String name, final String title, final AbstractImagePrototype icon,
- final String iconAlign, final boolean countVisible) {
- stack.addStackItem(name, title, icon, iconAlign, countVisible);
- }
-
- public void addStackItem(final String name, final String title, final boolean countVisible) {
- stack.addStackItem(name, title, countVisible);
- }
-
- public void addStackSubItem(final String parentItemName, final AbstractImagePrototype icon, final String name,
- final String title, final StackSubItemAction[] memberActions) {
- stack.addStackSubItem(parentItemName, icon, name, title, memberActions, presenter);
- headerCount++;
- updateHeaderText();
- }
-
- public void cleanBottomLinks() {
- final Iterator<String> iter = bottomLinksIndex.iterator();
- while (iter.hasNext()) {
- bottomLinksVP.remove(0);
- }
- bottomLinksIndex.clear();
- }
-
- public void clear() {
- commentsVP.clear();
- commentsVP.setVisible(false);
- generalVP.remove(commentsVP);
- stack.clear();
- bottomLinksIndex.clear();
- bottomLinksVP.clear();
- headerCount = 0;
- updateHeaderText();
- }
-
- /* Stack items */
-
- public int getHeaderCount() {
- return headerCount;
- }
-
- public String getHeaderText() {
- return headerText;
- }
-
- public String getHeaderTitle() {
- return headerTitle;
- }
-
- public boolean isHeaderCountVisible() {
- return headerCountVisible;
- }
-
- /* Stack subItems */
-
- public void removeBottomLink(final String text) {
- bottomLinksVP.remove(indexOfLink(text));
- }
-
- public void removeStackItem(final String name) {
- stack.removeStackItem(name);
- }
-
- /* Bottom links */
-
- public void removeStackSubItem(final String parentItemName, final String name) {
- stack.removeStackSubItem(parentItemName, name);
- headerCount--;
- updateHeaderText();
- }
-
- public void setDropDownContentVisible(final boolean visible) {
- setContentVisible(visible);
- }
-
- public void setHeaderCountVisible(final boolean headerCountVisible) {
- this.headerCountVisible = headerCountVisible;
- }
-
- public void setHeaderText(final String headerText) {
- this.headerText = headerText;
- }
-
- public void setHeaderTitle(final String headerTitle) {
- this.headerTitle = headerTitle;
- super.setHeaderTitle(headerTitle);
- }
-
- public void showStackItem(final String name) {
- stack.showStackItem(name);
- }
-
- public void updateHeaderText() {
- if (headerCountVisible) {
- super.setHeaderText(headerText + " (" + headerCount + ")");
- } else {
- super.setHeaderText(headerText);
- }
- }
-
- private int indexOfLink(final String text) {
- return bottomLinksIndex.indexOf(text);
- }
-
-}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/utils/PrefetchUtilities.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/utils/PrefetchUtilities.java 2008-07-31 13:28:16 UTC (rev 822)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/utils/PrefetchUtilities.java 2008-08-01 10:53:22 UTC (rev 823)
@@ -20,75 +20,73 @@
package org.ourproject.kune.platf.client.utils;
-import org.ourproject.kune.workspace.client.workspace.Workspace;
-
import com.google.gwt.user.client.DeferredCommand;
import com.google.gwt.user.client.IncrementalCommand;
import com.google.gwt.user.client.ui.Image;
public class PrefetchUtilities {
- public static void preFetchImpImages() {
- String[] imgs = { "images/spin-kune-thund-green.gif", "css/img/button-bg-hard.gif",
- "css/img/button-bg-soft.gif", "css/img/arrow-down-white.gif", "css/img/arrow-right-white.gif",
- "images/lic/bysa80x15.png" };
- for (int i = 0; i < imgs.length; i++) {
- String img = imgs[i];
- Image.prefetch(img);
- }
- }
+ public static void doTasksDeferred() {
- public static void doTasksDeferred(final Workspace workspace) {
+ DeferredCommand.addCommand(new IncrementalCommand() {
+ int i = 0;
+ int j = 0;
- DeferredCommand.addCommand(new IncrementalCommand() {
- int i = 0;
- int j = 0;
+ String[] lic = { "gnu-fdl.gif", "bynd80x15.png", "byncsa80x15.png", "byncnd80x15.png", "bync80x15.png",
+ "by80x15.png", "fal-license.gif" };
- String[] lic = { "gnu-fdl.gif", "bynd80x15.png", "byncsa80x15.png", "byncnd80x15.png", "bync80x15.png",
- "by80x15.png", "fal-license.gif" };
+ String[] ext = { "default/form/text-bg.gif", "default/form/trigger.gif", "default/form/date-trigger.gif",
+ "gray/window/left-corners.png", "gray/button/btn-sprite.gif", "gray/window/top-bottom.png",
+ "gray/window/right-corners.png", "gray/window/left-right.png", "default/sizer/s-handle.gif",
+ "default/sizer/e-handle.gif", "default/sizer/ne-handle.gif", "default/sizer/se-handle.gif",
+ "default/sizer/sw-handle.gif", "gray/panel/tool-sprites.gif", "default/sizer/nw-handle.gif",
+ "gray/tabs/tabs-sprite.gif", "gray/tabs/tab-strip-bg.gif", "default/shadow.png",
+ "default/shadow-lr.png", "default/shadow-c.png", "default/grid/invalid_line.gif",
+ "default/form/exclamation.gif", "default/box/tb-blue.gif", "default/grid/loading.gif",
+ "gray/toolbar/bg.gif", "default/grid/grid3-hrow.gif", "default/dd/drop-no.gif",
+ "default/grid/col-move-top.gif", "default/grid/col-move-bottom.gif", "default/grid/row-over.gif",
+ "default/grid/grid-split.gif", "default/grid/page-first-disabled.gif",
+ "default/grid/page-last-disabled.gif", "default/grid/done.gif",
+ "default/grid/page-prev-disabled.gif", "default/grid/done.gif",
+ "default/grid/page-next-disabled.gif", "default/qtip/tip-sprite.gif",
+ "default/grid/grid3-hrow-over.gif", "default/grid/grid3-hd-btn.gif",
+ "gray/panel/white-top-bottom.gif", "gray/tabs/tab-close.gif", "gray/toolbar/btn-arrow.gif",
+ "gray/toolbar/tb-btn-sprite.gif", "gray/panel/light-hd.gif" };
- String[] ext = { "default/form/text-bg.gif", "default/form/trigger.gif", "default/form/date-trigger.gif",
- "gray/window/left-corners.png", "gray/button/btn-sprite.gif", "gray/window/top-bottom.png",
- "gray/window/right-corners.png", "gray/window/left-right.png", "default/sizer/s-handle.gif",
- "default/sizer/e-handle.gif", "default/sizer/ne-handle.gif", "default/sizer/se-handle.gif",
- "default/sizer/sw-handle.gif", "gray/panel/tool-sprites.gif", "default/sizer/nw-handle.gif",
- "gray/tabs/tabs-sprite.gif", "gray/tabs/tab-strip-bg.gif", "default/shadow.png",
- "default/shadow-lr.png", "default/shadow-c.png", "default/grid/invalid_line.gif",
- "default/form/exclamation.gif", "default/box/tb-blue.gif", "default/grid/loading.gif",
- "gray/toolbar/bg.gif", "default/grid/grid3-hrow.gif", "default/dd/drop-no.gif",
- "default/grid/col-move-top.gif", "default/grid/col-move-bottom.gif", "default/grid/row-over.gif",
- "default/grid/grid-split.gif", "default/grid/page-first-disabled.gif",
- "default/grid/page-last-disabled.gif", "default/grid/done.gif",
- "default/grid/page-prev-disabled.gif", "default/grid/done.gif",
- "default/grid/page-next-disabled.gif", "default/qtip/tip-sprite.gif",
- "default/grid/grid3-hrow-over.gif", "default/grid/grid3-hd-btn.gif",
- "gray/panel/white-top-bottom.gif", "gray/tabs/tab-close.gif", "gray/toolbar/btn-arrow.gif",
- "gray/toolbar/tb-btn-sprite.gif", "gray/panel/light-hd.gif" };
+ public boolean execute() {
- public boolean execute() {
+ while (i < lic.length) {
+ final String licImg = lic[i];
+ Image.prefetch("images/lic/" + licImg);
+ i++;
+ }
- while (i < lic.length) {
- String licImg = lic[i];
- Image.prefetch("images/lic/" + licImg);
- i++;
- }
+ while (j < ext.length) {
+ final String extImg = ext[j];
+ Image.prefetch("js/ext/resources/images/" + extImg);
+ j++;
+ }
- while (j < ext.length) {
- String extImg = ext[j];
- Image.prefetch("js/ext/resources/images/" + extImg);
- j++;
- }
+ boolean notFinished = i + j < lic.length + ext.length;
- boolean notFinished = i + j < lic.length + ext.length;
+ final boolean finished = !notFinished;
- boolean finished = !notFinished;
+ if (finished) {
+ // In the future maybe: workspace.getLoginComponent()
+ }
- if (finished) {
- // In the future maybe: workspace.getLoginComponent()
- }
+ return notFinished;
+ }
+ });
+ }
- return notFinished;
- }
- });
+ public static void preFetchImpImages() {
+ final String[] imgs = { "images/spin-kune-thund-green.gif", "css/img/button-bg-hard.gif",
+ "css/img/button-bg-soft.gif", "css/img/arrow-down-white.gif", "css/img/arrow-right-white.gif",
+ "images/lic/bysa80x15.png" };
+ for (int i = 0; i < imgs.length; i++) {
+ final String img = imgs[i];
+ Image.prefetch(img);
+ }
}
}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/WorkspaceClientModule.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/WorkspaceClientModule.java 2008-07-31 13:28:16 UTC (rev 822)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/WorkspaceClientModule.java 2008-08-01 10:53:22 UTC (rev 823)
@@ -19,14 +19,10 @@
*/
package org.ourproject.kune.workspace.client;
-import org.ourproject.kune.platf.client.PlatformEvents;
import org.ourproject.kune.platf.client.extend.ClientModule;
import org.ourproject.kune.platf.client.extend.Register;
import org.ourproject.kune.platf.client.state.Session;
import org.ourproject.kune.platf.client.state.StateManager;
-import org.ourproject.kune.workspace.client.actions.AttachToExtensibleWidgetAction;
-import org.ourproject.kune.workspace.client.actions.ClearExtensibleWidgetAction;
-import org.ourproject.kune.workspace.client.actions.DetachFromExtensibleWidgetAction;
import org.ourproject.kune.workspace.client.actions.RecalculateWorkspaceAction;
import org.ourproject.kune.workspace.client.actions.ReloadContextAction;
import org.ourproject.kune.workspace.client.actions.i18n.ShowTranslatorAction;
@@ -49,10 +45,6 @@
}
public void configure(final Register register) {
- 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.SHOW_TRANSLATOR, new ShowTranslatorAction(session, workspace, i18n));
register.addAction(WorkspaceEvents.RELOAD_CONTEXT, new ReloadContextAction(stateManager));
register.addAction(WorkspaceEvents.RECALCULATE_WORKSPACE_SIZE, new RecalculateWorkspaceAction(workspace));
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/WorkspaceFactory.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/WorkspaceFactory.java 2008-07-31 13:28:16 UTC (rev 822)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/WorkspaceFactory.java 2008-08-01 10:53:22 UTC (rev 823)
@@ -23,6 +23,7 @@
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.editor.TextEditor;
import org.ourproject.kune.workspace.client.editor.TextEditorListener;
import org.ourproject.kune.workspace.client.editor.TextEditorPanel;
@@ -55,11 +56,14 @@
import org.ourproject.kune.workspace.client.workspace.ui.ContentToolBarPanel;
import org.ourproject.kune.workspace.client.workspace.ui.WorkspacePanel;
+import com.calclab.suco.client.container.Provider;
+
public class WorkspaceFactory {
private static Session session;
private static I18nTranslationService i18n;
private static KuneErrorHandler errorHandler;
+ private static Provider<StateManager> stateManagerProvider;
public static ContentSubTitleComponent createContentSubTitleComponent() {
final ContentSubTitlePresenter presenter = new ContentSubTitlePresenter(i18n);
@@ -84,7 +88,7 @@
public static ContextItems createContextItems() {
final ContextItemsPresenter presenter = new ContextItemsPresenter(i18n);
- final ContextItemsPanel panel = new ContextItemsPanel(presenter, i18n);
+ final ContextItemsPanel panel = new ContextItemsPanel(presenter, i18n, stateManagerProvider);
presenter.init(panel);
return presenter;
}
@@ -112,10 +116,11 @@
public static Workspace createWorkspace(final Session session,
final ExtensibleWidgetsManager extensionPointManager, final I18nTranslationService i18n,
- final KuneErrorHandler errorHandler) {
+ final KuneErrorHandler errorHandler, final Provider<StateManager> stateManagerProvider) {
WorkspaceFactory.session = session;
WorkspaceFactory.i18n = i18n;
WorkspaceFactory.errorHandler = errorHandler;
+ WorkspaceFactory.stateManagerProvider = stateManagerProvider;
final WorkspacePresenter workspace = new WorkspacePresenter(session);
final WorkspaceView view = new WorkspacePanel(workspace, i18n);
workspace.init(view, extensionPointManager);
Deleted: trunk/src/main/java/org/ourproject/kune/workspace/client/actions/AttachToExtensibleWidgetAction.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/actions/AttachToExtensibleWidgetAction.java 2008-07-31 13:28:16 UTC (rev 822)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/actions/AttachToExtensibleWidgetAction.java 2008-08-01 10:53:22 UTC (rev 823)
@@ -1,37 +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.workspace.client.actions;
-
-import org.ourproject.kune.platf.client.dispatch.Action;
-import org.ourproject.kune.platf.client.extend.ExtensibleWidgetChild;
-import org.ourproject.kune.workspace.client.workspace.Workspace;
-
-public class AttachToExtensibleWidgetAction implements Action<ExtensibleWidgetChild> {
-
- private final Workspace workspace;
-
- public AttachToExtensibleWidgetAction(final Workspace workspace) {
- this.workspace = workspace;
- }
-
- public void execute(final ExtensibleWidgetChild element) {
- workspace.attachToExtensibleWidget(element);
- }
-}
Deleted: trunk/src/main/java/org/ourproject/kune/workspace/client/actions/ClearExtensibleWidgetAction.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/actions/ClearExtensibleWidgetAction.java 2008-07-31 13:28:16 UTC (rev 822)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/actions/ClearExtensibleWidgetAction.java 2008-08-01 10:53:22 UTC (rev 823)
@@ -1,36 +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.workspace.client.actions;
-
-import org.ourproject.kune.platf.client.dispatch.Action;
-import org.ourproject.kune.workspace.client.workspace.Workspace;
-
-public class ClearExtensibleWidgetAction implements Action<String> {
-
- private final Workspace workspace;
-
- public ClearExtensibleWidgetAction(final Workspace workspace) {
- this.workspace = workspace;
- }
-
- public void execute(final String extId) {
- workspace.clearExtensibleWidget(extId);
- }
-}
Deleted: trunk/src/main/java/org/ourproject/kune/workspace/client/actions/DetachFromExtensibleWidgetAction.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/actions/DetachFromExtensibleWidgetAction.java 2008-07-31 13:28:16 UTC (rev 822)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/actions/DetachFromExtensibleWidgetAction.java 2008-08-01 10:53:22 UTC (rev 823)
@@ -1,37 +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.workspace.client.actions;
-
-import org.ourproject.kune.platf.client.dispatch.Action;
-import org.ourproject.kune.platf.client.extend.ExtensibleWidgetChild;
-import org.ourproject.kune.workspace.client.workspace.Workspace;
-
-public class DetachFromExtensibleWidgetAction implements Action<ExtensibleWidgetChild> {
-
- private final Workspace workspace;
-
- public DetachFromExtensibleWidgetAction(final Workspace workspace) {
- this.workspace = workspace;
- }
-
- public void execute(final ExtensibleWidgetChild element) {
- workspace.detachFromExtensibleWidget(element);
- }
-}
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-07-31 13:28:16 UTC (rev 822)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/presence/ui/GroupSummaryPanel.java 2008-08-01 10:53:22 UTC (rev 823)
@@ -19,10 +19,10 @@
*/
package org.ourproject.kune.workspace.client.presence.ui;
-import org.ourproject.kune.platf.client.AbstractPresenter;
import org.ourproject.kune.platf.client.services.I18nTranslationService;
import org.ourproject.kune.platf.client.ui.DropDownPanel;
import org.ourproject.kune.workspace.client.sitebar.Site;
+import org.ourproject.kune.workspace.client.summary.GroupSummaryPresenter;
import org.ourproject.kune.workspace.client.summary.GroupSummaryView;
import org.ourproject.kune.workspace.client.ui.newtmp.skel.WorkspaceSkeleton;
@@ -33,7 +33,7 @@
private final VerticalPanel vp;
- public GroupSummaryPanel(final AbstractPresenter presenter, final I18nTranslationService i18n,
+ public GroupSummaryPanel(final GroupSummaryPresenter presenter, final I18nTranslationService i18n,
final WorkspaceSkeleton ws) {
super(i18n.t("Group Summary"), true);
setHeaderTitle(i18n.t("Some summarized information about current project" + Site.IN_DEVELOPMENT));
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/search/SiteSearcherPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/search/SiteSearcherPresenter.java 2008-07-31 13:28:16 UTC (rev 822)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/search/SiteSearcherPresenter.java 2008-08-01 10:53:22 UTC (rev 823)
@@ -22,17 +22,21 @@
import java.util.HashMap;
import java.util.Iterator;
-import org.ourproject.kune.platf.client.AbstractPresenter;
import org.ourproject.kune.platf.client.View;
+import org.ourproject.kune.platf.client.state.StateManager;
import org.ourproject.kune.workspace.client.sitebar.Site;
-public class SiteSearcherPresenter extends AbstractPresenter implements SiteSearcher {
+import com.calclab.suco.client.container.Provider;
+public class SiteSearcherPresenter implements SiteSearcher {
+
private SiteSearcherView view;
private SiteSearcherType currentSearch;
private final HashMap<String, Integer> searchHistory;
+ private final Provider<StateManager> stateManagerProvider;
- public SiteSearcherPresenter() {
+ public SiteSearcherPresenter(final Provider<StateManager> stateManagerProvider) {
+ this.stateManagerProvider = stateManagerProvider;
searchHistory = new HashMap<String, Integer>();
currentSearch = SiteSearcherType.group_user;
}
@@ -41,6 +45,10 @@
view.hide();
}
+ public void doGoto(final String groupShortName) {
+ stateManagerProvider.get().gotoToken(groupShortName);
+ }
+
public void doSearch(final SiteSearcherType typeOfSearch) {
doSearchOfType(view.getTextToSearch(), typeOfSearch);
}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/GroupMembersSummaryPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/GroupMembersSummaryPresenter.java 2008-07-31 13:28:16 UTC (rev 822)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/GroupMembersSummaryPresenter.java 2008-08-01 10:53:22 UTC (rev 823)
@@ -20,11 +20,13 @@
import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService;
import org.ourproject.kune.workspace.client.sitebar.Site;
import org.ourproject.kune.workspace.client.ui.newtmp.themes.WsTheme;
+import org.ourproject.kune.workspace.client.ui.newtmp.themes.WsThemePresenter;
import org.ourproject.kune.workspace.client.workspace.GroupMembersSummary;
import org.ourproject.kune.workspace.client.workspace.UserLiveSearcher;
import com.calclab.suco.client.container.Provider;
import com.calclab.suco.client.signal.Slot;
+import com.calclab.suco.client.signal.Slot2;
public class GroupMembersSummaryPresenter extends SocialNetworkPresenter implements GroupMembersSummary {
@@ -36,15 +38,27 @@
private final GridGroup pendigCategory;
private final Session session;
private final Provider<SocialNetworkServiceAsync> snServiceProvider;
+ private final StateManager stateManager;
- public GroupMembersSummaryPresenter(final I18nUITranslationService i18n,
- final Provider<StateManager> stateManagerProvider, final ImageUtils imageUtils, final Session session,
+ public GroupMembersSummaryPresenter(final I18nUITranslationService i18n, final StateManager stateManager,
+ final ImageUtils imageUtils, final Session session,
final Provider<SocialNetworkServiceAsync> snServiceProvider,
- final Provider<UserLiveSearcher> userLiveSearcherProvider) {
- super(i18n, stateManagerProvider, imageUtils, session, snServiceProvider);
+ final Provider<UserLiveSearcher> userLiveSearcherProvider, final WsThemePresenter wsThemePresenter) {
+ super(i18n, stateManager, imageUtils, session, snServiceProvider);
this.i18n = i18n;
+ this.stateManager = stateManager;
this.session = session;
this.snServiceProvider = snServiceProvider;
+ stateManager.onStateChanged(new Slot<StateDTO>() {
+ public void onEvent(final StateDTO state) {
+ setState(state);
+ }
+ });
+ wsThemePresenter.onThemeChanged(new Slot2<WsTheme, WsTheme>() {
+ public void onEvent(final WsTheme oldTheme, final WsTheme newTheme) {
+ view.setTheme(oldTheme, newTheme);
+ }
+ });
final String adminsTitle = i18n.t("Admins");
final String collabsTitle = i18n.t("Collaborators");
final String pendingTitle = i18n.t("Pending");
@@ -77,7 +91,7 @@
public void onSuccess(final SocialNetworkResultDTO result) {
Site.hideProgress();
Site.info(i18n.t("Member added as collaborator"));
- getStateManager().setSocialNetwork(result);
+ stateManager.setSocialNetwork(result);
}
});
@@ -87,18 +101,6 @@
this.view = view;
}
- public void setState(final StateDTO state) {
- if (state.getGroup().getType().equals(GroupDTO.PERSONAL)) {
- view.setVisible(false);
- } else {
- setGroupMembers(state.getGroupMembers(), state.getGroupRights());
- }
- }
-
- public void setTheme(final WsTheme oldTheme, final WsTheme newTheme) {
- view.setTheme(oldTheme, newTheme);
- }
-
private boolean isMember(final boolean userIsAdmin, final boolean userIsCollab) {
return userIsAdmin || userIsCollab;
}
@@ -164,4 +166,12 @@
}
}
+ private void setState(final StateDTO state) {
+ if (state.getGroup().getType().equals(GroupDTO.PERSONAL)) {
+ view.setVisible(false);
+ } else {
+ setGroupMembers(state.getGroupMembers(), state.getGroupRights());
+ }
+ }
+
}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/ParticipationSummaryPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/ParticipationSummaryPresenter.java 2008-07-31 13:28:16 UTC (rev 822)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/ParticipationSummaryPresenter.java 2008-08-01 10:53:22 UTC (rev 823)
@@ -33,9 +33,12 @@
import org.ourproject.kune.platf.client.ui.gridmenu.GridGroup;
import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService;
import org.ourproject.kune.workspace.client.ui.newtmp.themes.WsTheme;
+import org.ourproject.kune.workspace.client.ui.newtmp.themes.WsThemePresenter;
import org.ourproject.kune.workspace.client.workspace.ParticipationSummary;
import com.calclab.suco.client.container.Provider;
+import com.calclab.suco.client.signal.Slot;
+import com.calclab.suco.client.signal.Slot2;
public class ParticipationSummaryPresenter extends SocialNetworkPresenter implements ParticipationSummary {
@@ -44,10 +47,10 @@
private GridGroup collabCategory;
private final GridGroup collabOnlyCategory;
- public ParticipationSummaryPresenter(final I18nUITranslationService i18n,
- final Provider<StateManager> stateManagerProvider, final ImageUtils imageUtils, final Session session,
- final Provider<SocialNetworkServiceAsync> snServiceProvider) {
- super(i18n, stateManagerProvider, imageUtils, session, snServiceProvider);
+ public ParticipationSummaryPresenter(final I18nUITranslationService i18n, final StateManager stateManager,
+ final ImageUtils imageUtils, final Session session,
+ final Provider<SocialNetworkServiceAsync> snServiceProvider, final WsThemePresenter wsThemePresenter) {
+ super(i18n, stateManager, imageUtils, session, snServiceProvider);
adminCategory = new GridGroup("admin in:", " ", i18n.tWithNT("Administrate these groups",
"talking about a person"), false);
collabCategory = new GridGroup(i18n.t("and as collaborator in:"), " ", i18n.t("Collaborate in these groups"),
@@ -55,14 +58,28 @@
collabOnlyCategory = new GridGroup(i18n.t("collaborator in:"), " ", i18n.t("Collaborate in these groups"),
false);
super.addGroupOperation(gotoGroupMenuItem, false);
+ stateManager.onStateChanged(new Slot<StateDTO>() {
+ public void onEvent(final StateDTO state) {
+ setState(state);
+ }
+ });
+ wsThemePresenter.onThemeChanged(new Slot2<WsTheme, WsTheme>() {
+ public void onEvent(final WsTheme oldTheme, final WsTheme newTheme) {
+ view.setTheme(oldTheme, newTheme);
+ }
+ });
}
public void init(final ParticipationSummaryView view) {
this.view = view;
}
+ private void hide() {
+ view.hide();
+ }
+
@SuppressWarnings("unchecked")
- public void setState(final StateDTO state) {
+ private void setState(final StateDTO state) {
final ParticipationDataDTO participation = state.getParticipation();
final AccessRightsDTO rights = state.getGroupRights();
view.clear();
@@ -95,12 +112,4 @@
}
- public void setTheme(final WsTheme oldTheme, final WsTheme newTheme) {
- view.setTheme(oldTheme, newTheme);
- }
-
- private void hide() {
- view.hide();
- }
-
}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/SocialNetworkPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/SocialNetworkPresenter.java 2008-07-31 13:28:16 UTC (rev 822)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/SocialNetworkPresenter.java 2008-08-01 10:53:22 UTC (rev 823)
@@ -35,18 +35,18 @@
protected GridMenuItem<GroupDTO> gotoGroupMenuItem;
protected GridMenuItem<GroupDTO> unJoinMenuItem;
private final I18nUITranslationService i18n;
- private final Provider<StateManager> stateManagerProvider;
+ private final StateManager stateManager;
private final Provider<SocialNetworkServiceAsync> snServiceProvider;
private final Session session;
private final GridMenuItemCollection<GroupDTO> otherOperations;
private final GridMenuItemCollection<GroupDTO> otherLoggedOperations;
private final ImageUtils imageUtils;
- public SocialNetworkPresenter(final I18nUITranslationService i18n,
- final Provider<StateManager> stateManagerProvider, final ImageUtils imageUtils, final Session session,
+ public SocialNetworkPresenter(final I18nUITranslationService i18n, final StateManager stateManager,
+ final ImageUtils imageUtils, final Session session,
final Provider<SocialNetworkServiceAsync> snServiceProvider) {
this.i18n = i18n;
- this.stateManagerProvider = stateManagerProvider;
+ this.stateManager = stateManager;
this.imageUtils = imageUtils;
this.session = session;
this.snServiceProvider = snServiceProvider;
@@ -80,10 +80,6 @@
return gridItem;
}
- protected StateManager getStateManager() {
- return stateManagerProvider.get();
- }
-
private void createButtons() {
requestJoin = new GridButton("images/add-green.gif", i18n.t("Participate"), i18n
.t("Request to participate in this group"), new Slot<String>() {
@@ -96,7 +92,7 @@
final String resultType = (String) result;
if (resultType == SocialNetworkDTO.REQ_JOIN_ACEPTED) {
Site.info(i18n.t("You are now member of this group"));
- getStateManager().reload();
+ stateManager.reload();
}
if (resultType == SocialNetworkDTO.REQ_JOIN_DENIED) {
Site.important(i18n.t("Sorry this is a closed group"));
@@ -136,13 +132,13 @@
gotoGroupMenuItem = new GridMenuItem<GroupDTO>("images/group-home.gif", i18n.t("Visit this group homepage"),
new Slot<GroupDTO>() {
public void onEvent(final GroupDTO groupDTO) {
- getStateManager().gotoToken(groupDTO.getShortName());
+ stateManager.gotoToken(groupDTO.getShortName());
}
});
gotoMemberMenuItem = new GridMenuItem<GroupDTO>("images/group-home.gif", i18n.t("Visit this member homepage"),
new Slot<GroupDTO>() {
public void onEvent(final GroupDTO groupDTO) {
- getStateManager().gotoToken(groupDTO.getShortName());
+ stateManager.gotoToken(groupDTO.getShortName());
}
});
unJoinMenuItem = new GridMenuItem<GroupDTO>("images/del.gif", i18n
@@ -161,7 +157,7 @@
public void onSuccess(final SocialNetworkResultDTO result) {
Site.hideProgress();
Site.info(i18n.t("Type of member changed"));
- getStateManager().setSocialNetwork(result);
+ stateManager.setSocialNetwork(result);
}
});
}
@@ -176,7 +172,7 @@
public void onSuccess(final SocialNetworkResultDTO result) {
Site.hideProgress();
Site.info(i18n.t("Member removed"));
- getStateManager().reload();
+ stateManager.reload();
// in the future, only if I cannot
// be affected:
// snService.stateManager.reloadSocialNetwork((SocialNetworkResultDTO)
@@ -195,7 +191,7 @@
public void onSuccess(final SocialNetworkResultDTO result) {
Site.hideProgress();
Site.info(i18n.t("Type of member changed"));
- getStateManager().setSocialNetwork(result);
+ stateManager.setSocialNetwork(result);
}
});
}
@@ -210,7 +206,7 @@
public void onSuccess(final SocialNetworkResultDTO result) {
Site.hideProgress();
Site.info(i18n.t("Member accepted"));
- getStateManager().setSocialNetwork(result);
+ stateManager.setSocialNetwork(result);
}
});
}
@@ -225,7 +221,7 @@
public void onSuccess(final SocialNetworkResultDTO result) {
Site.hideProgress();
Site.info(i18n.t("Member rejected"));
- getStateManager().setSocialNetwork(result);
+ stateManager.setSocialNetwork(result);
}
});
}
@@ -243,7 +239,7 @@
public void onSuccess(final SocialNetworkResultDTO result) {
Site.hideProgress();
Site.info(i18n.t("Removed as member"));
- getStateManager().reload();
+ stateManager.reload();
// in the future with user info:
// services.stateManager.reloadSocialNetwork((SocialNetworkResultDTO)
// result);
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/summary/GroupSummaryPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/summary/GroupSummaryPresenter.java 2008-07-31 13:28:16 UTC (rev 822)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/summary/GroupSummaryPresenter.java 2008-08-01 10:53:22 UTC (rev 823)
@@ -19,16 +19,33 @@
*/
package org.ourproject.kune.workspace.client.summary;
-import org.ourproject.kune.platf.client.AbstractPresenter;
import org.ourproject.kune.platf.client.View;
import org.ourproject.kune.platf.client.dto.StateDTO;
+import org.ourproject.kune.platf.client.state.StateManager;
import org.ourproject.kune.workspace.client.ui.newtmp.themes.WsTheme;
+import org.ourproject.kune.workspace.client.ui.newtmp.themes.WsThemePresenter;
import org.ourproject.kune.workspace.client.workspace.GroupSummary;
-public class GroupSummaryPresenter extends AbstractPresenter implements GroupSummary {
+import com.calclab.suco.client.signal.Slot;
+import com.calclab.suco.client.signal.Slot2;
+public class GroupSummaryPresenter implements GroupSummary {
+
private GroupSummaryView view;
+ public GroupSummaryPresenter(final StateManager stateManager, final WsThemePresenter wsThemePresenter) {
+ stateManager.onStateChanged(new Slot<StateDTO>() {
+ public void onEvent(final StateDTO state) {
+ setState(state);
+ }
+ });
+ wsThemePresenter.onThemeChanged(new Slot2<WsTheme, WsTheme>() {
+ public void onEvent(final WsTheme oldTheme, final WsTheme newTheme) {
+ view.setTheme(oldTheme, newTheme);
+ }
+ });
+ }
+
public View getView() {
return view;
}
@@ -37,12 +54,8 @@
this.view = view;
}
- public void setState(final StateDTO state) {
+ private void setState(final StateDTO state) {
view.setComment("Summary about this group (in development)");
}
- public void setTheme(final WsTheme oldTheme, final WsTheme newTheme) {
- view.setTheme(oldTheme, newTheme);
- }
-
}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/tags/TagsSummaryPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/tags/TagsSummaryPresenter.java 2008-07-31 13:28:16 UTC (rev 822)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/tags/TagsSummaryPresenter.java 2008-08-01 10:53:22 UTC (rev 823)
@@ -26,12 +26,16 @@
import org.ourproject.kune.platf.client.dto.StateDTO;
import org.ourproject.kune.platf.client.dto.TagResultDTO;
import org.ourproject.kune.platf.client.state.Session;
+import org.ourproject.kune.platf.client.state.StateManager;
import org.ourproject.kune.workspace.client.search.SiteSearcher;
import org.ourproject.kune.workspace.client.search.SiteSearcherType;
import org.ourproject.kune.workspace.client.ui.newtmp.themes.WsTheme;
+import org.ourproject.kune.workspace.client.ui.newtmp.themes.WsThemePresenter;
import org.ourproject.kune.workspace.client.workspace.TagsSummary;
import com.calclab.suco.client.container.Provider;
+import com.calclab.suco.client.signal.Slot;
+import com.calclab.suco.client.signal.Slot2;
public class TagsSummaryPresenter implements TagsSummary {
@@ -39,9 +43,20 @@
private final Provider<SiteSearcher> searcherProvider;
private final Provider<Session> sessionProvider;
- public TagsSummaryPresenter(final Provider<Session> sessionProvider, final Provider<SiteSearcher> searcherProvider) {
+ public TagsSummaryPresenter(final Provider<Session> sessionProvider, final Provider<SiteSearcher> searcherProvider,
+ final StateManager stateManager, final WsThemePresenter wsThemePresenter) {
this.sessionProvider = sessionProvider;
this.searcherProvider = searcherProvider;
+ stateManager.onStateChanged(new Slot<StateDTO>() {
+ public void onEvent(final StateDTO state) {
+ setState(state);
+ }
+ });
+ wsThemePresenter.onThemeChanged(new Slot2<WsTheme, WsTheme>() {
+ public void onEvent(final WsTheme oldTheme, final WsTheme newTheme) {
+ view.setTheme(oldTheme, newTheme);
+ }
+ });
}
public void doSearchTag(final String name) {
@@ -62,11 +77,8 @@
view.setTags(groupTags);
}
- public void setState(final StateDTO state) {
+ private void setState(final StateDTO state) {
view.setTags(state.getGroupTags());
}
- public void setTheme(final WsTheme oldTheme, final WsTheme newTheme) {
- view.setTheme(oldTheme, newTheme);
- }
}
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-07-31 13:28:16 UTC (rev 822)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/items/ContextItems.java 2008-08-01 10:53:22 UTC (rev 823)
@@ -25,18 +25,23 @@
import org.ourproject.kune.platf.client.dto.ContainerDTO;
import org.ourproject.kune.platf.client.dto.StateToken;
+import com.calclab.suco.client.signal.Slot;
import com.google.gwt.user.client.ui.AbstractImagePrototype;
public interface ContextItems {
+
+ public void canCreate(String typeName, String label, Slot<?> slot);
+
+ public void canCreate(String typeName, String label, String eventName);
+
public View getView();
public void registerType(String typeName, AbstractImagePrototype pageWhite);
- public void canCreate(String typeName, String label, String eventName);
+ public void setControlsVisible(boolean visible);
public void setParentTreeVisible(boolean visible);
public void showContainer(StateToken state, ContainerDTO container, AccessRightsDTO rights);
- public void setControlsVisible(boolean visible);
}
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-07-31 13:28:16 UTC (rev 822)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/items/ContextItemsPanel.java 2008-08-01 10:53:22 UTC (rev 823)
@@ -23,9 +23,11 @@
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.state.StateManager;
import org.ourproject.kune.platf.client.ui.HorizontalLine;
import org.ourproject.kune.platf.client.ui.IconLabel;
+import com.calclab.suco.client.container.Provider;
import com.google.gwt.user.client.ui.AbstractImagePrototype;
import com.google.gwt.user.client.ui.ClickListener;
import com.google.gwt.user.client.ui.DockPanel;
@@ -43,103 +45,104 @@
private String workaroundTypeName;
private final I18nTranslationService i18n;
- public ContextItemsPanel(final ContextItemsPresenter presenter, final I18nTranslationService i18n) {
- this.presenter = presenter;
- this.i18n = i18n;
- topBar = new ContextTopBar(presenter, i18n);
- addTopBar(topBar);
+ public ContextItemsPanel(final ContextItemsPresenter presenter, final I18nTranslationService i18n,
+ final Provider<StateManager> stateManagerProvider) {
+ this.presenter = presenter;
+ this.i18n = i18n;
+ topBar = new ContextTopBar(presenter, i18n, stateManagerProvider);
+ addTopBar(topBar);
- items = new ItemsPanel(presenter);
- add(items, DockPanel.NORTH);
- HTML expand = new HTML("<b></b>");
- add(expand, DockPanel.CENTER);
- controls = new VerticalPanel();
- add(controls, DockPanel.SOUTH);
- controls.setVerticalAlignment(VerticalPanel.ALIGN_MIDDLE);
- HorizontalLine horizontalLine = new HorizontalLine();
- controls.add(horizontalLine);
+ items = new ItemsPanel(presenter);
+ add(items, DockPanel.NORTH);
+ final HTML expand = new HTML("<b></b>");
+ add(expand, DockPanel.CENTER);
+ controls = new VerticalPanel();
+ add(controls, DockPanel.SOUTH);
+ controls.setVerticalAlignment(VerticalPanel.ALIGN_MIDDLE);
+ final HorizontalLine horizontalLine = new HorizontalLine();
+ controls.add(horizontalLine);
- // setHeight("100%");
- expand.setHeight("15px");
- setCellHeight(expand, "15px");
- addStyleName("kune-NavigationBar");
- controls.setWidth("100%");
- controls.setCellWidth(horizontalLine, "100%");
- horizontalLine.setWidth("100%");
+ // setHeight("100%");
+ expand.setHeight("15px");
+ setCellHeight(expand, "15px");
+ addStyleName("kune-NavigationBar");
+ controls.setWidth("100%");
+ controls.setCellWidth(horizontalLine, "100%");
+ horizontalLine.setWidth("100%");
}
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);
+ final String type = typeName;
+ final 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);
+ items.add(name, type, event, editable);
}
public void clear() {
- items.clear();
+ items.clear();
}
public void registerType(final String typeName, final AbstractImagePrototype image) {
- items.registerType(typeName, image);
+ items.registerType(typeName, image);
}
public void selectItem(final int index) {
}
public void setAbsolutePath(final ContainerSimpleDTO[] absolutePath) {
- topBar.setAbsolutePath(absolutePath);
+ topBar.setAbsolutePath(absolutePath);
}
public void setControlsVisible(final boolean visible) {
- controls.setVisible(visible);
+ controls.setVisible(visible);
}
public void setCurrentName(final String name) {
- topBar.currentFolder.setText(name);
+ topBar.currentFolder.setText(name);
}
public void setParentButtonEnabled(final boolean isEnabled) {
- topBar.btnGoParent.setVisible(isEnabled);
- topBar.btnGoParentDisabled.setVisible(!isEnabled);
+ topBar.btnGoParent.setVisible(isEnabled);
+ topBar.btnGoParentDisabled.setVisible(!isEnabled);
}
public void setParentTreeVisible(final boolean visible) {
- topBar.firstRow.setVisible(visible);
+ topBar.firstRow.setVisible(visible);
}
public void showCreationField(final String typeName) {
- String title;
- // Workaround: gwt-ext bug, I cannot use typeName directly
- workaroundTypeName = 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);
- }
- });
+ // 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);
+ 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-07-31 13:28:16 UTC (rev 822)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/items/ContextItemsPresenter.java 2008-08-01 10:53:22 UTC (rev 823)
@@ -36,6 +36,7 @@
import org.ourproject.kune.workspace.client.WorkspaceEvents;
import org.ourproject.kune.workspace.client.sitebar.Site;
+import com.calclab.suco.client.signal.Slot;
import com.google.gwt.user.client.ui.AbstractImagePrototype;
public class ContextItemsPresenter implements ContextItems {
@@ -43,85 +44,89 @@
private final I18nTranslationService i18n;
public ContextItemsPresenter(final I18nTranslationService i18n) {
- this.i18n = i18n;
+ this.i18n = i18n;
}
+ public void canCreate(final String typeName, final String label, final Slot<?> slot) {
+ // TODO
+ }
+
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(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-07-31 13:28:16 UTC (rev 822)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/items/ContextTopBar.java 2008-08-01 10:53:22 UTC (rev 823)
@@ -20,13 +20,13 @@
package org.ourproject.kune.workspace.client.ui.ctx.items;
-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.I18nTranslationService;
+import org.ourproject.kune.platf.client.state.StateManager;
import org.ourproject.kune.platf.client.ui.KuneUiUtils;
import org.ourproject.kune.platf.client.ui.RoundedBorderDecorator;
+import com.calclab.suco.client.container.Provider;
import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.ui.ClickListener;
import com.google.gwt.user.client.ui.HorizontalPanel;
@@ -46,76 +46,79 @@
private final ContextItemsImages img;
private final MenuBar pathSubmenu;
private final I18nTranslationService i18n;
+ private final Provider<StateManager> stateManagerProvider;
- public ContextTopBar(final ContextItemsPresenter presenter, final I18nTranslationService i18n) {
- this.i18n = i18n;
- img = ContextItemsImages.App.getInstance();
- firstRow = new HorizontalPanel();
- final HorizontalPanel secondRow = new HorizontalPanel();
- final HorizontalPanel iconBarHP = new HorizontalPanel();
- final HorizontalPanel currentFolderHP = new HorizontalPanel();
- btnGoParent = new PushButton(img.folderGoUp().createImage(), img.folderGoUpLight().createImage());
- btnGoParent.addClickListener(new ClickListener() {
- public void onClick(final Widget sender) {
- presenter.onGoUp();
- }
- });
+ public ContextTopBar(final ContextItemsPresenter presenter, final I18nTranslationService i18n,
+ final Provider<StateManager> stateManagerProvider) {
+ this.i18n = i18n;
+ this.stateManagerProvider = stateManagerProvider;
+ img = ContextItemsImages.App.getInstance();
+ firstRow = new HorizontalPanel();
+ final HorizontalPanel secondRow = new HorizontalPanel();
+ final HorizontalPanel iconBarHP = new HorizontalPanel();
+ final HorizontalPanel currentFolderHP = new HorizontalPanel();
+ btnGoParent = new PushButton(img.folderGoUp().createImage(), img.folderGoUpLight().createImage());
+ btnGoParent.addClickListener(new ClickListener() {
+ public void onClick(final Widget sender) {
+ presenter.onGoUp();
+ }
+ });
- KuneUiUtils.setQuickTip(btnGoParent, i18n.t("Go to parent folder"));
- btnGoParentDisabled = img.folderGoUpLight().createImage();
- final MenuBar pathMenu = new MenuBar();
- pathSubmenu = new MenuBar(true);
- // Layout
- add(firstRow);
- add(secondRow);
- firstRow.add(iconBarHP);
- secondRow.add(currentFolderHP);
- // iconBarHP.add(btnGoParent);
- final RoundedBorderDecorator buttonRounded = new RoundedBorderDecorator(pathMenu, RoundedBorderDecorator.ALL,
- RoundedBorderDecorator.SIMPLE);
- iconBarHP.add(buttonRounded);
- pathMenu.addItem(img.folderpathmenu().getHTML(), true, pathSubmenu);
- KuneUiUtils.setQuickTip(pathMenu, i18n.t("Navigation tree"));
- currentFolderHP.add(btnGoParent);
- currentFolderHP.add(btnGoParentDisabled);
- currentFolder = new Label("Current Container");
- currentFolderHP.add(currentFolder);
+ KuneUiUtils.setQuickTip(btnGoParent, i18n.t("Go to parent folder"));
+ btnGoParentDisabled = img.folderGoUpLight().createImage();
+ final MenuBar pathMenu = new MenuBar();
+ pathSubmenu = new MenuBar(true);
+ // Layout
+ add(firstRow);
+ add(secondRow);
+ firstRow.add(iconBarHP);
+ secondRow.add(currentFolderHP);
+ // iconBarHP.add(btnGoParent);
+ final RoundedBorderDecorator buttonRounded = new RoundedBorderDecorator(pathMenu, RoundedBorderDecorator.ALL,
+ RoundedBorderDecorator.SIMPLE);
+ iconBarHP.add(buttonRounded);
+ pathMenu.addItem(img.folderpathmenu().getHTML(), true, pathSubmenu);
+ KuneUiUtils.setQuickTip(pathMenu, i18n.t("Navigation tree"));
+ currentFolderHP.add(btnGoParent);
+ currentFolderHP.add(btnGoParentDisabled);
+ currentFolder = new Label("Current Container");
+ currentFolderHP.add(currentFolder);
- // Set properties
- addStyleName("kune-NavigationBar");
- firstRow.addStyleName("topBar");
- firstRow.addStyleName("topBar-margin");
- secondRow.addStyleName("topBar");
- firstRow.setWidth("100%");
- secondRow.setWidth("100%");
- setCellWidth(firstRow, "100%");
- setCellWidth(secondRow, "100%");
- firstRow.setVerticalAlignment(VerticalPanel.ALIGN_MIDDLE);
- iconBarHP.addStyleName("kune-topBar-iconBar");
- iconBarHP.setCellVerticalAlignment(btnGoParent, VerticalPanel.ALIGN_MIDDLE);
- iconBarHP.setCellVerticalAlignment(buttonRounded, VerticalPanel.ALIGN_MIDDLE);
- pathMenu.setStyleName("pathMenu");
- buttonRounded.setColor("AAA");
- btnGoParent.addStyleName("kune-pointer");
+ // Set properties
+ addStyleName("kune-NavigationBar");
+ firstRow.addStyleName("topBar");
+ firstRow.addStyleName("topBar-margin");
+ secondRow.addStyleName("topBar");
+ firstRow.setWidth("100%");
+ secondRow.setWidth("100%");
+ setCellWidth(firstRow, "100%");
+ setCellWidth(secondRow, "100%");
+ firstRow.setVerticalAlignment(VerticalPanel.ALIGN_MIDDLE);
+ iconBarHP.addStyleName("kune-topBar-iconBar");
+ iconBarHP.setCellVerticalAlignment(btnGoParent, VerticalPanel.ALIGN_MIDDLE);
+ iconBarHP.setCellVerticalAlignment(buttonRounded, VerticalPanel.ALIGN_MIDDLE);
+ pathMenu.setStyleName("pathMenu");
+ buttonRounded.setColor("AAA");
+ btnGoParent.addStyleName("kune-pointer");
}
public void setAbsolutePath(final ContainerSimpleDTO[] absolutePath) {
- pathSubmenu.clearItems();
- String indent = "";
- for (int i = 0; i < absolutePath.length; i++) {
- final ContainerSimpleDTO folder = absolutePath[i];
- String folderName = folder.getName();
- if (i == 0) {
- // We translate root folders
- folderName = i18n.t(folderName);
- }
- pathSubmenu.addItem(indent + img.folder().getHTML() + " " + folderName, true, new Command() {
- public void execute() {
- DefaultDispatcher.getInstance().fire(PlatformEvents.GOTO_CONTAINER, folder.getId());
- }
- });
- indent = indent + "  ";
- }
+ pathSubmenu.clearItems();
+ String indent = "";
+ for (int i = 0; i < absolutePath.length; i++) {
+ final ContainerSimpleDTO folder = absolutePath[i];
+ String folderName = folder.getName();
+ if (i == 0) {
+ // We translate root folders
+ folderName = i18n.t(folderName);
+ }
+ pathSubmenu.addItem(indent + img.folder().getHTML() + " " + folderName, true, new Command() {
+ public void execute() {
+ stateManagerProvider.get().gotoContainer(folder.getId());
+ }
+ });
+ indent = indent + "  ";
+ }
}
}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/WorkspaceManager.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/WorkspaceManager.java 2008-07-31 13:28:16 UTC (rev 822)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/WorkspaceManager.java 2008-08-01 10:53:22 UTC (rev 823)
@@ -1,12 +1,9 @@
package org.ourproject.kune.workspace.client.ui.newtmp;
-import org.ourproject.kune.platf.client.dto.GroupDTO;
-import org.ourproject.kune.platf.client.dto.StateDTO;
import org.ourproject.kune.platf.client.ui.rate.RateIt;
import org.ourproject.kune.platf.client.ui.rate.RatePresenter;
import org.ourproject.kune.workspace.client.ui.newtmp.licensefoot.EntityLicensePresenter;
import org.ourproject.kune.workspace.client.ui.newtmp.sitebar.sitepublic.SitePublicSpaceLink;
-import org.ourproject.kune.workspace.client.ui.newtmp.themes.WsTheme;
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;
@@ -17,7 +14,6 @@
import org.ourproject.kune.workspace.client.workspace.ui.EntityLogo;
import com.calclab.suco.client.container.Provider;
-import com.calclab.suco.client.signal.Slot2;
public class WorkspaceManager {
@@ -53,37 +49,6 @@
this.groupSummaryProvider = groupSummaryProvider;
this.rateItProvider = rateItProvider;
this.ratePresenterProvider = rateProvider;
- wsThemePresenter.onThemeChanged(new Slot2<WsTheme, WsTheme>() {
- public void onEvent(final WsTheme oldTheme, final WsTheme newTheme) {
- entityLogo.setTheme(oldTheme, newTheme);
- groupMembersSummaryProvider.get().setTheme(oldTheme, newTheme);
- participationSummaryProvider.get().setTheme(oldTheme, newTheme);
- groupSummaryProvider.get().setTheme(oldTheme, newTheme);
- tagsSummaryProvider.get().setTheme(oldTheme, newTheme);
- }
- });
}
- public void setSocialNetwork(final StateDTO state) {
- groupMembersSummaryProvider.get().setState(state);
- participationSummaryProvider.get().setState(state);
- }
-
- public void setState(final StateDTO state) {
- publicSpaceLink.setState(state);
- final GroupDTO group = state.getGroup();
- final boolean isAdmin = state.getGroupRights().isAdministrable();
- entityLogo.setLogo(group.getLongName());
- entityLogo.setPutYourLogoVisible(isAdmin);
- entityTitlePresenter.setState(state);
- entitySubTitlePresenter.setState(state);
- entityLicensePresenter.setLicense(state);
- setSocialNetwork(state);
- groupSummaryProvider.get().setState(state);
- tagsProvider.get().setState(state);
- wsThemePresenter.setState(state);
- rateItProvider.get().setState(state);
- ratePresenterProvider.get().setState(state);
- }
-
}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/licensefoot/EntityLicensePresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/licensefoot/EntityLicensePresenter.java 2008-07-31 13:28:16 UTC (rev 822)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/licensefoot/EntityLicensePresenter.java 2008-08-01 10:53:22 UTC (rev 823)
@@ -22,13 +22,21 @@
import org.ourproject.kune.platf.client.View;
import org.ourproject.kune.platf.client.dto.LicenseDTO;
import org.ourproject.kune.platf.client.dto.StateDTO;
+import org.ourproject.kune.platf.client.state.StateManager;
+import com.calclab.suco.client.signal.Slot;
+
public class EntityLicensePresenter {
private EntityLicenseView view;
private LicenseDTO license;
- public EntityLicensePresenter() {
+ public EntityLicensePresenter(final StateManager stateManager) {
+ stateManager.onStateChanged(new Slot<StateDTO>() {
+ public void onEvent(final StateDTO state) {
+ setLicense(state);
+ }
+ });
}
public View getView() {
@@ -43,7 +51,7 @@
view.openWindow(license.getUrl());
}
- public void setLicense(final StateDTO state) {
+ private void setLicense(final StateDTO state) {
this.license = state.getLicense();
view.showLicense(state.getGroup().getLongName(), license);
}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/sitepublic/SitePublicSpaceLink.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/sitepublic/SitePublicSpaceLink.java 2008-07-31 13:28:16 UTC (rev 822)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/sitepublic/SitePublicSpaceLink.java 2008-08-01 10:53:22 UTC (rev 823)
@@ -1,11 +1,8 @@
package org.ourproject.kune.workspace.client.ui.newtmp.sitebar.sitepublic;
-import org.ourproject.kune.platf.client.dto.StateDTO;
public interface SitePublicSpaceLink {
- void setState(StateDTO state);
-
void setVisible(boolean visible);
}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/sitepublic/SitePublicSpaceLinkPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/sitepublic/SitePublicSpaceLinkPresenter.java 2008-07-31 13:28:16 UTC (rev 822)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/sitepublic/SitePublicSpaceLinkPresenter.java 2008-08-01 10:53:22 UTC (rev 823)
@@ -4,12 +4,20 @@
import org.ourproject.kune.platf.client.dto.GroupListDTO;
import org.ourproject.kune.platf.client.dto.StateDTO;
import org.ourproject.kune.platf.client.dto.StateToken;
+import org.ourproject.kune.platf.client.state.StateManager;
+import com.calclab.suco.client.signal.Slot;
+
public class SitePublicSpaceLinkPresenter implements SitePublicSpaceLink {
private SitePublicSpaceLinkView view;
- public SitePublicSpaceLinkPresenter() {
+ public SitePublicSpaceLinkPresenter(final StateManager stateManager) {
+ stateManager.onStateChanged(new Slot<StateDTO>() {
+ public void onEvent(final StateDTO state) {
+ setState(state);
+ }
+ });
}
public View getView() {
@@ -20,7 +28,11 @@
this.view = view;
}
- public void setState(final StateDTO state) {
+ public void setVisible(final boolean visible) {
+ view.setVisible(visible);
+ }
+
+ private void setState(final StateDTO state) {
final StateToken token = state.getStateToken();
if (state.getAccessLists().getViewers().getMode().equals(GroupListDTO.EVERYONE)) {
final String publicUrl = token.getPublicUrl();
@@ -31,8 +43,4 @@
}
}
- public void setVisible(final boolean visible) {
- view.setVisible(visible);
- }
-
}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/themes/WsThemePresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/themes/WsThemePresenter.java 2008-07-31 13:28:16 UTC (rev 822)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/themes/WsThemePresenter.java 2008-08-01 10:53:22 UTC (rev 823)
@@ -5,6 +5,7 @@
import org.ourproject.kune.platf.client.rpc.AsyncCallbackSimple;
import org.ourproject.kune.platf.client.rpc.GroupServiceAsync;
import org.ourproject.kune.platf.client.state.Session;
+import org.ourproject.kune.platf.client.state.StateManager;
import org.ourproject.kune.workspace.client.sitebar.Site;
import com.calclab.suco.client.container.Provider;
@@ -20,7 +21,8 @@
private final Provider<GroupServiceAsync> groupServiceProvider;
private final Session session;
- public WsThemePresenter(final Session session, final Provider<GroupServiceAsync> groupServiceProvider) {
+ public WsThemePresenter(final Session session, final Provider<GroupServiceAsync> groupServiceProvider,
+ final StateManager stateManager) {
this.session = session;
this.groupServiceProvider = groupServiceProvider;
this.onThemeChanged = new Signal2<WsTheme, WsTheme>("onThemeChanged");
@@ -29,6 +31,11 @@
view.setThemes(initData.getWsThemes());
}
});
+ stateManager.onStateChanged(new Slot<StateDTO>() {
+ public void onEvent(final StateDTO state) {
+ setState(state);
+ }
+ });
}
public void init(final WsThemeView view) {
@@ -39,15 +46,6 @@
onThemeChanged.add(slot);
}
- public void setState(final StateDTO state) {
- setTheme(new WsTheme(state.getGroup().getWorkspaceTheme()));
- if (state.getGroupRights().isAdministrable()) {
- view.setVisible(true);
- } else {
- view.setVisible(false);
- }
- }
-
protected void onChangeGroupWsTheme(final WsTheme newTheme) {
Site.showProgressProcessing();
groupServiceProvider.get().changeGroupWsTheme(session.getUserHash(),
@@ -60,6 +58,15 @@
});
}
+ private void setState(final StateDTO state) {
+ setTheme(new WsTheme(state.getGroup().getWorkspaceTheme()));
+ if (state.getGroupRights().isAdministrable()) {
+ view.setVisible(true);
+ } else {
+ view.setVisible(false);
+ }
+ }
+
private void setTheme(final WsTheme newTheme) {
if (previousTheme == null || !previousTheme.equals(newTheme)) {
onThemeChanged.fire(previousTheme, newTheme);
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/title/EntitySubTitlePresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/title/EntitySubTitlePresenter.java 2008-07-31 13:28:16 UTC (rev 822)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/title/EntitySubTitlePresenter.java 2008-08-01 10:53:22 UTC (rev 823)
@@ -23,14 +23,22 @@
import org.ourproject.kune.platf.client.View;
import org.ourproject.kune.platf.client.dto.StateDTO;
import org.ourproject.kune.platf.client.services.I18nTranslationService;
+import org.ourproject.kune.platf.client.state.StateManager;
+import com.calclab.suco.client.signal.Slot;
+
public class EntitySubTitlePresenter {
private EntitySubTitleView view;
private final I18nTranslationService i18n;
- public EntitySubTitlePresenter(final I18nTranslationService i18n) {
+ public EntitySubTitlePresenter(final I18nTranslationService i18n, final StateManager stateManager) {
this.i18n = i18n;
+ stateManager.onStateChanged(new Slot<StateDTO>() {
+ public void onEvent(final StateDTO state) {
+ setState(state);
+ }
+ });
}
public View getView() {
@@ -45,7 +53,7 @@
view.setContentSubTitleRight(i18n.t("Language: [%s]", langName));
}
- public void setState(final StateDTO state) {
+ private void setState(final StateDTO state) {
if (state.hasDocument()) {
view.setContentSubTitleLeft(i18n.tWithNT("by: [%s]", "used in a list of authors", state.getAuthors().get(0)
.getName()));
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-07-31 13:28:16 UTC (rev 822)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/title/EntityTitlePresenter.java 2008-08-01 10:53:22 UTC (rev 823)
@@ -29,9 +29,11 @@
import org.ourproject.kune.platf.client.rpc.ParamCallback;
import org.ourproject.kune.platf.client.services.I18nTranslationService;
import org.ourproject.kune.platf.client.services.KuneErrorHandler;
+import org.ourproject.kune.platf.client.state.StateManager;
import org.ourproject.kune.workspace.client.WorkspaceEvents;
import org.ourproject.kune.workspace.client.sitebar.Site;
+import com.calclab.suco.client.signal.Slot;
import com.google.gwt.i18n.client.DateTimeFormat;
import com.google.gwt.user.client.rpc.AsyncCallback;
@@ -41,9 +43,15 @@
private final I18nTranslationService i18n;
private final KuneErrorHandler errorHandler;
- public EntityTitlePresenter(final I18nTranslationService i18n, final KuneErrorHandler errorHandler) {
+ public EntityTitlePresenter(final I18nTranslationService i18n, final KuneErrorHandler errorHandler,
+ final StateManager stateManager) {
this.i18n = i18n;
this.errorHandler = errorHandler;
+ stateManager.onStateChanged(new Slot<StateDTO>() {
+ public void onEvent(final StateDTO state) {
+ setState(state);
+ }
+ });
}
public View getView() {
@@ -72,7 +80,21 @@
new ParamCallback<String, String>(text, callback));
}
- public void setState(final StateDTO state) {
+ private void setContentDate(final Date publishedOn) {
+ final DateTimeFormat fmt = DateTimeFormat.getFormat("MM/dd/yyyy, Z");
+ view.setContentDate(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) {
+ view.setContentTitle(title);
+ view.setContentTitleEditable(editable);
+ }
+
+ private void setState(final StateDTO state) {
if (state.hasDocument()) {
setContentTitle(state.getTitle(), state.getContentRights().isEditable());
setContentDateVisible(true);
@@ -89,18 +111,4 @@
}
}
- private void setContentDate(final Date publishedOn) {
- final DateTimeFormat fmt = DateTimeFormat.getFormat("MM/dd/yyyy, Z");
- view.setContentDate(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) {
- view.setContentTitle(title);
- view.setContentTitleEditable(editable);
- }
-
}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/workspace/GroupMembersSummary.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/workspace/GroupMembersSummary.java 2008-07-31 13:28:16 UTC (rev 822)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/workspace/GroupMembersSummary.java 2008-08-01 10:53:22 UTC (rev 823)
@@ -21,16 +21,10 @@
package org.ourproject.kune.workspace.client.workspace;
import org.ourproject.kune.platf.client.dto.GroupDTO;
-import org.ourproject.kune.platf.client.dto.StateDTO;
import org.ourproject.kune.platf.client.ui.gridmenu.GridMenuItem;
-import org.ourproject.kune.workspace.client.ui.newtmp.themes.WsTheme;
public interface GroupMembersSummary {
- public void setState(StateDTO state);
-
- public void setTheme(WsTheme oldTheme, WsTheme newTheme);
-
void addGroupOperation(GridMenuItem<GroupDTO> operation, boolean mustBeLogged);
void removeGroupOperation(GridMenuItem<GroupDTO> operation, boolean mustBeLogged);
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/workspace/GroupSummary.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/workspace/GroupSummary.java 2008-07-31 13:28:16 UTC (rev 822)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/workspace/GroupSummary.java 2008-08-01 10:53:22 UTC (rev 823)
@@ -20,13 +20,7 @@
package org.ourproject.kune.workspace.client.workspace;
-import org.ourproject.kune.platf.client.dto.StateDTO;
-import org.ourproject.kune.workspace.client.ui.newtmp.themes.WsTheme;
public interface GroupSummary {
- void setState(StateDTO state);
-
- void setTheme(WsTheme oldTheme, WsTheme newTheme);
-
}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/workspace/ParticipationSummary.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/workspace/ParticipationSummary.java 2008-07-31 13:28:16 UTC (rev 822)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/workspace/ParticipationSummary.java 2008-08-01 10:53:22 UTC (rev 823)
@@ -20,13 +20,7 @@
package org.ourproject.kune.workspace.client.workspace;
-import org.ourproject.kune.platf.client.dto.StateDTO;
-import org.ourproject.kune.workspace.client.ui.newtmp.themes.WsTheme;
public interface ParticipationSummary {
- void setState(StateDTO state);
-
- void setTheme(WsTheme oldTheme, WsTheme newTheme);
-
}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/workspace/TagsSummary.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/workspace/TagsSummary.java 2008-07-31 13:28:16 UTC (rev 822)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/workspace/TagsSummary.java 2008-08-01 10:53:22 UTC (rev 823)
@@ -22,16 +22,10 @@
import java.util.List;
-import org.ourproject.kune.platf.client.dto.StateDTO;
import org.ourproject.kune.platf.client.dto.TagResultDTO;
-import org.ourproject.kune.workspace.client.ui.newtmp.themes.WsTheme;
public interface TagsSummary {
void setGroupTags(List<TagResultDTO> result);
- void setState(StateDTO state);
-
- void setTheme(WsTheme oldTheme, WsTheme newTheme);
-
}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/workspace/Workspace.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/workspace/Workspace.java 2008-07-31 13:28:16 UTC (rev 822)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/workspace/Workspace.java 2008-08-01 10:53:22 UTC (rev 823)
@@ -23,9 +23,7 @@
import org.ourproject.kune.platf.client.Component;
import org.ourproject.kune.platf.client.dto.GroupDTO;
-import org.ourproject.kune.platf.client.extend.ExtensibleWidgetChild;
import org.ourproject.kune.platf.client.tool.ClientTool;
-import org.ourproject.kune.workspace.client.component.WorkspaceComponent;
import org.ourproject.kune.workspace.client.licensefoot.LicenseComponent;
public interface Workspace extends Component {
@@ -36,28 +34,18 @@
public void adjustSize(int windowWidth, int clientHeight);
- public void attachToExtensibleWidget(ExtensibleWidgetChild ext);
-
public void attachTools(Iterator<ClientTool> iterator);
public int calculateHeight(int clientHeight);
public int calculateWidth(int clientWidth);
- public void clearExtensibleWidget(String extId);
-
- public void detachFromExtensibleWidget(ExtensibleWidgetChild ext);
-
public ContentSubTitleComponent getContentSubTitleComponent();
public ContentTitleComponent getContentTitleComponent();
public LicenseComponent getLicenseComponent();
- public void setContent(WorkspaceComponent contentComponent);
-
- public void setContext(WorkspaceComponent contextComponent);
-
public void setTheme(String theme);
public void setTool(String toolName);
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/workspace/ui/EntityLogo.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/workspace/ui/EntityLogo.java 2008-07-31 13:28:16 UTC (rev 822)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/workspace/ui/EntityLogo.java 2008-08-01 10:53:22 UTC (rev 823)
@@ -1,17 +1,6 @@
package org.ourproject.kune.workspace.client.workspace.ui;
-import org.ourproject.kune.workspace.client.ui.newtmp.themes.WsTheme;
-import com.google.gwt.user.client.ui.Image;
-
public interface EntityLogo {
- public abstract void setLogo(final Image image);
-
- public abstract void setLogo(final String groupName);
-
- public abstract void setPutYourLogoVisible(final boolean visible);
-
- public abstract void setTheme(final WsTheme oldTheme, WsTheme newTheme);
-
}
\ No newline at end of file
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/workspace/ui/EntityLogoPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/workspace/ui/EntityLogoPanel.java 2008-07-31 13:28:16 UTC (rev 822)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/workspace/ui/EntityLogoPanel.java 2008-08-01 10:53:22 UTC (rev 823)
@@ -33,7 +33,7 @@
import com.google.gwt.user.client.ui.SimplePanel;
import com.google.gwt.user.client.ui.VerticalPanel;
-public class EntityLogoPanel extends SimplePanel implements EntityLogo {
+public class EntityLogoPanel extends SimplePanel implements EntityLogoView {
class EntityTextLogo extends VerticalPanel {
private static final int GROUP_NAME_LIMIT_SIZE = 90;
Added: trunk/src/main/java/org/ourproject/kune/workspace/client/workspace/ui/EntityLogoPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/workspace/ui/EntityLogoPresenter.java 2008-07-31 13:28:16 UTC (rev 822)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/workspace/ui/EntityLogoPresenter.java 2008-08-01 10:53:22 UTC (rev 823)
@@ -0,0 +1,37 @@
+package org.ourproject.kune.workspace.client.workspace.ui;
+
+import org.ourproject.kune.platf.client.dto.GroupDTO;
+import org.ourproject.kune.platf.client.dto.StateDTO;
+import org.ourproject.kune.platf.client.state.StateManager;
+import org.ourproject.kune.workspace.client.ui.newtmp.themes.WsTheme;
+import org.ourproject.kune.workspace.client.ui.newtmp.themes.WsThemePresenter;
+
+import com.calclab.suco.client.signal.Slot;
+import com.calclab.suco.client.signal.Slot2;
+
+public class EntityLogoPresenter implements EntityLogo {
+ private EntityLogoView view;
+
+ public EntityLogoPresenter(final StateManager stateManager, final WsThemePresenter theme) {
+ stateManager.onStateChanged(new Slot<StateDTO>() {
+ public void onEvent(final StateDTO state) {
+ final GroupDTO group = state.getGroup();
+ final boolean isAdmin = state.getGroupRights().isAdministrable();
+
+ view.setLogo(group.getLongName());
+ view.setPutYourLogoVisible(isAdmin);
+ }
+ });
+ theme.onThemeChanged(new Slot2<WsTheme, WsTheme>() {
+ public void onEvent(final WsTheme oldTheme, final WsTheme newTheme) {
+ view.setTheme(oldTheme, newTheme);
+ }
+ });
+ }
+
+ public void init(final EntityLogoView view) {
+ this.view = view;
+
+ }
+
+}
Added: trunk/src/main/java/org/ourproject/kune/workspace/client/workspace/ui/EntityLogoView.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/workspace/ui/EntityLogoView.java 2008-07-31 13:28:16 UTC (rev 822)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/workspace/ui/EntityLogoView.java 2008-08-01 10:53:22 UTC (rev 823)
@@ -0,0 +1,17 @@
+package org.ourproject.kune.workspace.client.workspace.ui;
+
+import org.ourproject.kune.workspace.client.ui.newtmp.themes.WsTheme;
+
+import com.google.gwt.user.client.ui.Image;
+
+public interface EntityLogoView {
+
+ // FIXME: Don' use Image
+ public abstract void setLogo(final Image image);
+
+ public abstract void setLogo(final String groupName);
+
+ public abstract void setPutYourLogoVisible(final boolean visible);
+
+ public abstract void setTheme(final WsTheme oldTheme, WsTheme newTheme);
+}
Modified: trunk/src/test/java/org/ourproject/kune/platf/client/state/StateManagerTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/client/state/StateManagerTest.java 2008-07-31 13:28:16 UTC (rev 822)
+++ trunk/src/test/java/org/ourproject/kune/platf/client/state/StateManagerTest.java 2008-08-01 10:53:22 UTC (rev 823)
@@ -7,7 +7,6 @@
import org.ourproject.kune.platf.client.dto.StateDTO;
import org.ourproject.kune.platf.client.dto.StateToken;
import org.ourproject.kune.workspace.client.sitebar.SiteToken;
-import org.ourproject.kune.workspace.client.ui.newtmp.WorkspaceManager;
import com.calclab.suco.client.signal.Slot;
import com.google.gwt.user.client.rpc.AsyncCallback;
@@ -34,8 +33,7 @@
contentProvider = Mockito.mock(ContentProvider.class);
session = Mockito.mock(Session.class);
history = Mockito.mock(HistoryWrapper.class);
- final WorkspaceManager ws = Mockito.mock(WorkspaceManager.class);
- stateManager = new StateManagerDefault(contentProvider, session, history, ws);
+ stateManager = new StateManagerDefault(contentProvider, session, history);
Mockito.stub(session.getUserHash()).toReturn(HASH);
}
More information about the kune-commits
mailing list