r942 - in trunk: . src/main/java/org/ourproject/kune/chat/client src/main/java/org/ourproject/kune/chat/client/cnt src/main/java/org/ourproject/kune/chat/client/cnt/room src/main/java/org/ourproject/kune/docs/client src/main/java/org/ourproject/kune/docs/client/cnt src/main/java/org/ourproject/kune/docs/client/cnt/folder/viewer src/main/java/org/ourproject/kune/platf/client/actions/toolbar src/main/java/org/ourproject/kune/platf/client/services src/main/java/org/ourproject/kune/platf/client/s
Author: vjrj Date: 2008-11-06 22:03:52 +0100 (Thu, 06 Nov 2008) New Revision: 942 Added: trunk/src/main/java/org/ourproject/kune/docs/client/cnt/folder/viewer/DocFolderContent.java trunk/src/main/java/org/ourproject/kune/docs/client/cnt/folder/viewer/DocFolderContentPanel.java trunk/src/main/java/org/ourproject/kune/docs/client/cnt/folder/viewer/DocFolderContentPresenter.java trunk/src/main/java/org/ourproject/kune/docs/client/cnt/folder/viewer/DocFolderContentView.java trunk/src/main/java/org/ourproject/kune/platf/client/actions/toolbar/ActionContentToolbar.java trunk/src/main/java/org/ourproject/kune/platf/client/actions/toolbar/ActionContentToolbarPresenter.java trunk/src/main/java/org/ourproject/kune/platf/client/actions/toolbar/ActionContextToolbar.java trunk/src/main/java/org/ourproject/kune/platf/client/actions/toolbar/ActionContextToolbarPresenter.java trunk/src/main/java/org/ourproject/kune/workspace/client/cnt/ trunk/src/main/java/org/ourproject/kune/workspace/client/cnt/AbstractContentPanel.java trunk/src/main/java/org/ourproject/kune/workspace/client/cnt/AbstractContentPresenter.java trunk/src/main/java/org/ourproject/kune/workspace/client/cnt/AbstractContentView.java trunk/src/main/java/org/ourproject/kune/workspace/client/cnt/FoldableContentPresenter.java Removed: trunk/src/main/java/org/ourproject/kune/chat/client/cnt/ChatContent.java trunk/src/main/java/org/ourproject/kune/chat/client/cnt/ChatContentPresenter.java trunk/src/main/java/org/ourproject/kune/chat/client/cnt/info/ trunk/src/main/java/org/ourproject/kune/docs/client/cnt/folder/viewer/FolderViewer.java trunk/src/main/java/org/ourproject/kune/docs/client/cnt/folder/viewer/FolderViewerPanel.java trunk/src/main/java/org/ourproject/kune/docs/client/cnt/folder/viewer/FolderViewerPresenter.java trunk/src/main/java/org/ourproject/kune/docs/client/cnt/folder/viewer/FolderViewerView.java Modified: trunk/CREDITS trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientModule.java trunk/src/main/java/org/ourproject/kune/chat/client/cnt/room/ChatRoom.java trunk/src/main/java/org/ourproject/kune/chat/client/cnt/room/ChatRoomPanel.java trunk/src/main/java/org/ourproject/kune/chat/client/cnt/room/ChatRoomPresenter.java trunk/src/main/java/org/ourproject/kune/chat/client/cnt/room/ChatRoomView.java trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientModule.java trunk/src/main/java/org/ourproject/kune/docs/client/cnt/DocumentContentPresenter.java trunk/src/main/java/org/ourproject/kune/platf/client/actions/toolbar/ActionToolbarPanel.java trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneModule.java trunk/src/main/java/org/ourproject/kune/platf/client/state/StateManagerDefault.java Log: Incomplete - task UI tools & workspace refactorization Modified: trunk/CREDITS =================================================================== --- trunk/CREDITS 2008-11-06 00:35:01 UTC (rev 941) +++ trunk/CREDITS 2008-11-06 21:03:52 UTC (rev 942) @@ -10,7 +10,12 @@ Contributors -------------------------------------------------------------------------------- +* Thanks to Samer Hassan for all the feedback and ideas. +* Antonio Martins, Jéferson Assumção, Moacir Gadotti and the Instituto Paulo +Freire staff. +* Daniel Jiménez for the initial help +* Javier de la Cueva and Leovigildo García-Bobadilla for the legal support * Thanks to David Trigo and http://www.esperanto-es.net/ for suggest the name of 'kune' for our initiative: http://ourproject.org/forum/forum.php?thread_id=500&forum_id=469 - +* and ourproject.org and xsto.info for sharing whit us their resources Modified: trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientModule.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientModule.java 2008-11-06 00:35:01 UTC (rev 941) +++ trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientModule.java 2008-11-06 21:03:52 UTC (rev 942) @@ -18,10 +18,6 @@ * */package org.ourproject.kune.chat.client; -import org.ourproject.kune.chat.client.cnt.ChatContent; -import org.ourproject.kune.chat.client.cnt.ChatContentPresenter; -import org.ourproject.kune.chat.client.cnt.info.ChatInfo; -import org.ourproject.kune.chat.client.cnt.info.ChatInfoPanel; import org.ourproject.kune.chat.client.cnt.room.ChatRoom; import org.ourproject.kune.chat.client.cnt.room.ChatRoomPanel; import org.ourproject.kune.chat.client.cnt.room.ChatRoomPresenter; @@ -33,6 +29,7 @@ import org.ourproject.kune.platf.client.actions.ContentIconsRegistry; import org.ourproject.kune.platf.client.actions.ContextActionRegistry; import org.ourproject.kune.platf.client.actions.DragDropContentRegistry; +import org.ourproject.kune.platf.client.actions.toolbar.ActionContentToolbar; import org.ourproject.kune.platf.client.app.Application; import org.ourproject.kune.platf.client.app.ToolGroup; import org.ourproject.kune.platf.client.rpc.ContentServiceAsync; @@ -71,22 +68,6 @@ } }); - register(Singleton.class, new Factory<ChatInfo>(ChatInfo.class) { - @Override - public ChatInfo create() { - return new ChatInfoPanel(); - } - }); - - register(Singleton.class, new Factory<ChatContent>(ChatContent.class) { - @Override - public ChatContent create() { - final ChatContentPresenter presenter = new ChatContentPresenter($(EmiteUIDialog.class), - $$(ChatInfo.class), $$(ChatRoom.class)); - return presenter; - } - }); - register(Singleton.class, new Factory<ChatContext>(ChatContext.class) { @Override public ChatContext create() { @@ -95,7 +76,7 @@ } }); - register(Singleton.class, new Factory<ChatEngine>(ChatEngine.class) { + register(ToolGroup.class, new Factory<ChatEngine>(ChatEngine.class) { @Override public ChatEngine create() { return new ChatEngineDefault($(I18nUITranslationService.class), $(WorkspaceSkeleton.class), @@ -103,11 +84,14 @@ } }); - register(Singleton.class, new Factory<ChatRoom>(ChatRoom.class) { + register(ToolGroup.class, new Factory<ChatRoom>(ChatRoom.class) { @Override public ChatRoom create() { + final ChatRoomPresenter presenter = new ChatRoomPresenter($(StateManager.class), $(Session.class), + $(I18nUITranslationService.class), $(ActionContentToolbar.class), + $(ContentActionRegistry.class)); final ChatRoomPanel panel = new ChatRoomPanel($(WorkspaceSkeleton.class)); - final ChatRoomPresenter presenter = new ChatRoomPresenter(panel); + presenter.init(panel); return presenter; } }); Deleted: trunk/src/main/java/org/ourproject/kune/chat/client/cnt/ChatContent.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/chat/client/cnt/ChatContent.java 2008-11-06 00:35:01 UTC (rev 941) +++ trunk/src/main/java/org/ourproject/kune/chat/client/cnt/ChatContent.java 2008-11-06 21:03:52 UTC (rev 942) @@ -1,28 +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.cnt; - -import org.ourproject.kune.platf.client.dto.StateContainerDTO; - -public interface ChatContent { - - void setState(StateContainerDTO state); - -} Deleted: 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-11-06 00:35:01 UTC (rev 941) +++ trunk/src/main/java/org/ourproject/kune/chat/client/cnt/ChatContentPresenter.java 2008-11-06 21:03:52 UTC (rev 942) @@ -1,62 +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.cnt; - -import org.ourproject.kune.chat.client.ChatClientTool; -import org.ourproject.kune.chat.client.cnt.info.ChatInfo; -import org.ourproject.kune.chat.client.cnt.room.ChatRoom; -import org.ourproject.kune.platf.client.dto.StateContainerDTO; - -import com.allen_sauer.gwt.log.client.Log; -import com.calclab.emite.core.client.xmpp.stanzas.XmppURI; -import com.calclab.emiteuimodule.client.EmiteUIDialog; -import com.calclab.suco.client.ioc.Provider; - -public class ChatContentPresenter implements ChatContent { - - private StateContainerDTO state; - private final EmiteUIDialog emiteUIDialog; - private final Provider<ChatInfo> chatInfoProvider; - private final Provider<ChatRoom> chatRoomProvider; - - public ChatContentPresenter(final EmiteUIDialog emiteUIDialog, final Provider<ChatInfo> chatInfoProvider, - final Provider<ChatRoom> chatRoomProvider) { - this.emiteUIDialog = emiteUIDialog; - this.chatInfoProvider = chatInfoProvider; - this.chatRoomProvider = chatRoomProvider; - } - - public void onEnterRoom() { - final String roomName = state.getContainer().getName(); - emiteUIDialog.joinRoom(XmppURI.uri(roomName)); - } - - public void setState(final StateContainerDTO state) { - this.state = state; - final String typeId = state.getTypeId(); - if (typeId.equals(ChatClientTool.TYPE_ROOT)) { - chatInfoProvider.get().show(); - } else if (typeId.equals(ChatClientTool.TYPE_ROOM)) { - chatRoomProvider.get().show(); - } else { - Log.error("Programming error: unknown component!! please contact [email protected]"); - } - } -} Modified: trunk/src/main/java/org/ourproject/kune/chat/client/cnt/room/ChatRoom.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/chat/client/cnt/room/ChatRoom.java 2008-11-06 00:35:01 UTC (rev 941) +++ trunk/src/main/java/org/ourproject/kune/chat/client/cnt/room/ChatRoom.java 2008-11-06 21:03:52 UTC (rev 942) @@ -20,6 +20,4 @@ package org.ourproject.kune.chat.client.cnt.room; public interface ChatRoom { - - void show(); } Modified: trunk/src/main/java/org/ourproject/kune/chat/client/cnt/room/ChatRoomPanel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/chat/client/cnt/room/ChatRoomPanel.java 2008-11-06 00:35:01 UTC (rev 941) +++ trunk/src/main/java/org/ourproject/kune/chat/client/cnt/room/ChatRoomPanel.java 2008-11-06 21:03:52 UTC (rev 942) @@ -19,15 +19,24 @@ */ package org.ourproject.kune.chat.client.cnt.room; -import org.ourproject.kune.workspace.client.site.Site; +import org.ourproject.kune.workspace.client.cnt.AbstractContentPanel; import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton; import com.google.gwt.user.client.ui.Label; -public class ChatRoomPanel implements ChatRoomView { +public class ChatRoomPanel extends AbstractContentPanel implements ChatRoomView { + private final Label label; + public ChatRoomPanel(final WorkspaceSkeleton ws) { - ws.getEntityWorkspace().setContent(new Label("History of room conversations." + Site.IN_DEVELOPMENT)); + super(ws); + label = new Label(); + label.setStyleName("kune-Content-Main"); + label.addStyleName("kune-Margin-7-trbl"); + initWidget(label); } + public void setInfo(String info) { + label.setText(info); + } } Modified: trunk/src/main/java/org/ourproject/kune/chat/client/cnt/room/ChatRoomPresenter.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/chat/client/cnt/room/ChatRoomPresenter.java 2008-11-06 00:35:01 UTC (rev 941) +++ trunk/src/main/java/org/ourproject/kune/chat/client/cnt/room/ChatRoomPresenter.java 2008-11-06 21:03:52 UTC (rev 942) @@ -19,21 +19,44 @@ */ package org.ourproject.kune.chat.client.cnt.room; -import org.ourproject.kune.platf.client.View; +import org.ourproject.kune.chat.client.ChatClientTool; +import org.ourproject.kune.platf.client.actions.ActionRegistry; +import org.ourproject.kune.platf.client.actions.toolbar.ActionContentToolbar; +import org.ourproject.kune.platf.client.dto.StateContainerDTO; +import org.ourproject.kune.platf.client.dto.StateToken; +import org.ourproject.kune.platf.client.state.Session; +import org.ourproject.kune.platf.client.state.StateManager; +import org.ourproject.kune.workspace.client.cnt.FoldableContentPresenter; +import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService; +import org.ourproject.kune.workspace.client.site.Site; -public class ChatRoomPresenter implements ChatRoom { +public class ChatRoomPresenter extends FoldableContentPresenter implements ChatRoom { - private final ChatRoomView view; + private ChatRoomView view; + private final I18nUITranslationService i18n; - public ChatRoomPresenter(final ChatRoomView view) { - this.view = view; + public ChatRoomPresenter(StateManager stateManager, Session session, I18nUITranslationService i18n, + ActionContentToolbar toolbar, final ActionRegistry<StateToken> actionRegistry) { + super(ChatClientTool.NAME, stateManager, session, toolbar, actionRegistry); + this.i18n = i18n; } - public View getView() { - return view; + public void init(final ChatRoomView view) { + super.init(view); + this.view = view; } - public void show() { + @Override + protected void setState(StateContainerDTO state) { + if (state.getTypeId().equals(ChatClientTool.TYPE_ROOT)) { + if (state.getRootContainer().getChilds().size() == 0) { + view.setInfo(i18n.t("This group has no chat rooms.")); + } else { + view.setInfo(""); + } + } else { + view.setInfo("History of room conversations ..." + Site.IN_DEVELOPMENT); + } + super.setState(state); } - } Modified: trunk/src/main/java/org/ourproject/kune/chat/client/cnt/room/ChatRoomView.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/chat/client/cnt/room/ChatRoomView.java 2008-11-06 00:35:01 UTC (rev 941) +++ trunk/src/main/java/org/ourproject/kune/chat/client/cnt/room/ChatRoomView.java 2008-11-06 21:03:52 UTC (rev 942) @@ -19,8 +19,9 @@ */ package org.ourproject.kune.chat.client.cnt.room; -import org.ourproject.kune.platf.client.View; +import org.ourproject.kune.workspace.client.cnt.AbstractContentView; -public interface ChatRoomView extends View { +public interface ChatRoomView extends AbstractContentView { + void setInfo(String info); } Modified: trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientModule.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientModule.java 2008-11-06 00:35:01 UTC (rev 941) +++ trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientModule.java 2008-11-06 21:03:52 UTC (rev 942) @@ -21,10 +21,10 @@ import org.ourproject.kune.docs.client.cnt.DocumentContent; import org.ourproject.kune.docs.client.cnt.DocumentContentPanel; import org.ourproject.kune.docs.client.cnt.DocumentContentPresenter; -import org.ourproject.kune.docs.client.cnt.folder.viewer.FolderViewer; -import org.ourproject.kune.docs.client.cnt.folder.viewer.FolderViewerPanel; -import org.ourproject.kune.docs.client.cnt.folder.viewer.FolderViewerPresenter; -import org.ourproject.kune.docs.client.cnt.folder.viewer.FolderViewerView; +import org.ourproject.kune.docs.client.cnt.folder.viewer.DocFolderContent; +import org.ourproject.kune.docs.client.cnt.folder.viewer.DocFolderContentPanel; +import org.ourproject.kune.docs.client.cnt.folder.viewer.DocFolderContentPresenter; +import org.ourproject.kune.docs.client.cnt.folder.viewer.DocFolderContentView; import org.ourproject.kune.docs.client.cnt.viewer.DocumentViewer; import org.ourproject.kune.docs.client.cnt.viewer.DocumentViewerPanel; import org.ourproject.kune.docs.client.cnt.viewer.DocumentViewerPresenter; @@ -35,16 +35,12 @@ import org.ourproject.kune.docs.client.ctx.admin.DocContextEditorPanel; import org.ourproject.kune.docs.client.ctx.admin.DocContextEditorPresenter; import org.ourproject.kune.docs.client.ctx.admin.DocContextEditorView; -import org.ourproject.kune.platf.client.actions.ActionManager; import org.ourproject.kune.platf.client.actions.ContentActionRegistry; import org.ourproject.kune.platf.client.actions.ContentIconsRegistry; import org.ourproject.kune.platf.client.actions.ContextActionRegistry; import org.ourproject.kune.platf.client.actions.DragDropContentRegistry; -import org.ourproject.kune.platf.client.actions.toolbar.ActionToolbar; -import org.ourproject.kune.platf.client.actions.toolbar.ActionToolbarPanel; -import org.ourproject.kune.platf.client.actions.toolbar.ActionToolbarPresenter; +import org.ourproject.kune.platf.client.actions.toolbar.ActionContentToolbar; import org.ourproject.kune.platf.client.app.ToolGroup; -import org.ourproject.kune.platf.client.dto.StateToken; import org.ourproject.kune.platf.client.rpc.ContentServiceAsync; import org.ourproject.kune.platf.client.rpc.GroupServiceAsync; import org.ourproject.kune.platf.client.services.I18nTranslationService; @@ -98,14 +94,9 @@ register(ToolGroup.class, new Factory<DocumentContent>(DocumentContent.class) { @Override public DocumentContent create() { - final ActionToolbarPanel<StateToken> contentNavigatorToolbar = new ActionToolbarPanel<StateToken>( - ActionToolbarPanel.Position.content, $$(ActionManager.class), $(WorkspaceSkeleton.class)); - final ActionToolbar<StateToken> toolbar = new ActionToolbarPresenter<StateToken>( - contentNavigatorToolbar); - final DocumentContentPresenter presenter = new DocumentContentPresenter($(StateManager.class), - $(Session.class), $$(DocumentViewer.class), $$(TextEditor.class), $$(FolderViewer.class), - toolbar, $(ContentActionRegistry.class)); + $(Session.class), $$(DocumentViewer.class), $$(TextEditor.class), + $(ActionContentToolbar.class), $(ContentActionRegistry.class)); final DocumentContentPanel panel = new DocumentContentPanel($(WorkspaceSkeleton.class)); presenter.init(panel); return presenter; @@ -118,8 +109,8 @@ final DocContextEditorPresenter presenter = new DocContextEditorPresenter($(Session.class), $(StateManager.class), $$(TagsSummary.class), $$(ContentServiceAsync.class), $(EntityTitle.class), $(EntitySubTitle.class)); - final DocContextEditorView view = new DocContextEditorPanel(presenter, $(I18nUITranslationService.class), - $(WorkspaceSkeleton.class)); + final DocContextEditorView view = new DocContextEditorPanel(presenter, + $(I18nUITranslationService.class), $(WorkspaceSkeleton.class)); presenter.init(view); return presenter; } @@ -144,11 +135,13 @@ } }); - register(Singleton.class, new Factory<FolderViewer>(FolderViewer.class) { + register(ToolGroup.class, new Factory<DocFolderContent>(DocFolderContent.class) { @Override - public FolderViewer create() { - final FolderViewerView view = new FolderViewerPanel(); - final FolderViewerPresenter presenter = new FolderViewerPresenter(view); + public DocFolderContent create() { + final DocFolderContentPresenter presenter = new DocFolderContentPresenter($(StateManager.class), + $(Session.class), $(ActionContentToolbar.class), $(ContentActionRegistry.class)); + final DocFolderContentView view = new DocFolderContentPanel($(WorkspaceSkeleton.class)); + presenter.init(view); return presenter; } }); Modified: trunk/src/main/java/org/ourproject/kune/docs/client/cnt/DocumentContentPresenter.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/docs/client/cnt/DocumentContentPresenter.java 2008-11-06 00:35:01 UTC (rev 941) +++ trunk/src/main/java/org/ourproject/kune/docs/client/cnt/DocumentContentPresenter.java 2008-11-06 21:03:52 UTC (rev 942) @@ -20,7 +20,6 @@ package org.ourproject.kune.docs.client.cnt; import org.ourproject.kune.docs.client.DocumentClientTool; -import org.ourproject.kune.docs.client.cnt.folder.viewer.FolderViewer; import org.ourproject.kune.docs.client.cnt.viewer.DocumentViewer; import org.ourproject.kune.platf.client.actions.ActionItemCollection; import org.ourproject.kune.platf.client.actions.ActionRegistry; @@ -42,18 +41,15 @@ private final Session session; private final Provider<DocumentViewer> docReaderProvider; private final Provider<TextEditor> textEditorProvider; - private final Provider<FolderViewer> folderViewerProvider; private final ActionToolbar<StateToken> toolbar; private final ActionRegistry<StateToken> actionRegistry; public DocumentContentPresenter(final StateManager stateManager, final Session session, final Provider<DocumentViewer> docReaderProvider, final Provider<TextEditor> textEditorProvider, - final Provider<FolderViewer> folderViewerProvider, final ActionToolbar<StateToken> toolbar, - final ActionRegistry<StateToken> actionRegistry) { + final ActionToolbar<StateToken> toolbar, final ActionRegistry<StateToken> actionRegistry) { this.session = session; this.docReaderProvider = docReaderProvider; this.textEditorProvider = textEditorProvider; - this.folderViewerProvider = folderViewerProvider; this.toolbar = toolbar; this.actionRegistry = actionRegistry; stateManager.onStateChanged(new Listener<StateAbstractDTO>() { @@ -94,21 +90,12 @@ if (stateCntCtx instanceof StateContentDTO) { setState((StateContentDTO) stateCntCtx); } else if (stateCntCtx instanceof StateContainerDTO) { - setState(stateCntCtx); + // FIXME setState(stateCntCtx); } } } } - private void setState(final StateContainerDTO state) { - ActionItemCollection<StateToken> collection = actionRegistry.getCurrentActions(state.getStateToken(), - state.getTypeId(), session.isLogged(), state.getContainerRights(), true); - setToolbar(collection); - final FolderViewer viewer = folderViewerProvider.get(); - viewer.setFolder(state.getContainer()); - view.setContent(viewer.getView()); - } - private void setState(final StateContentDTO state) { ActionItemCollection<StateToken> collection = actionRegistry.getCurrentActions(state.getStateToken(), state.getTypeId(), session.isLogged(), state.getContentRights(), true); Copied: trunk/src/main/java/org/ourproject/kune/docs/client/cnt/folder/viewer/DocFolderContent.java (from rev 939, trunk/src/main/java/org/ourproject/kune/docs/client/cnt/folder/viewer/FolderViewer.java) =================================================================== --- trunk/src/main/java/org/ourproject/kune/docs/client/cnt/folder/viewer/FolderViewer.java 2008-11-04 15:07:14 UTC (rev 939) +++ trunk/src/main/java/org/ourproject/kune/docs/client/cnt/folder/viewer/DocFolderContent.java 2008-11-06 21:03:52 UTC (rev 942) @@ -0,0 +1,23 @@ +/* + * + * Copyright (C) 2007-2008 The kune development team (see CREDITS for details) + * This file is part of kune. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +package org.ourproject.kune.docs.client.cnt.folder.viewer; + +public interface DocFolderContent { +} Property changes on: trunk/src/main/java/org/ourproject/kune/docs/client/cnt/folder/viewer/DocFolderContent.java ___________________________________________________________________ Name: svn:mergeinfo + Copied: trunk/src/main/java/org/ourproject/kune/docs/client/cnt/folder/viewer/DocFolderContentPanel.java (from rev 939, trunk/src/main/java/org/ourproject/kune/docs/client/cnt/folder/viewer/FolderViewerPanel.java) =================================================================== --- trunk/src/main/java/org/ourproject/kune/docs/client/cnt/folder/viewer/FolderViewerPanel.java 2008-11-04 15:07:14 UTC (rev 939) +++ trunk/src/main/java/org/ourproject/kune/docs/client/cnt/folder/viewer/DocFolderContentPanel.java 2008-11-06 21:03:52 UTC (rev 942) @@ -0,0 +1,37 @@ +/* + * + * Copyright (C) 2007-2008 The kune development team (see CREDITS for details) + * This file is part of kune. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +package org.ourproject.kune.docs.client.cnt.folder.viewer; + +import org.ourproject.kune.workspace.client.cnt.AbstractContentPanel; +import org.ourproject.kune.workspace.client.site.Site; +import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton; + +import com.google.gwt.user.client.ui.Label; + +public class DocFolderContentPanel extends AbstractContentPanel implements DocFolderContentView { + + public DocFolderContentPanel(WorkspaceSkeleton ws) { + super(ws); + Label label = new Label("Folder properties, translations ..." + Site.IN_DEVELOPMENT); + label.setStyleName("kune-Content-Main"); + label.addStyleName("kune-Margin-7-trbl"); + initWidget(label); + } +} Copied: trunk/src/main/java/org/ourproject/kune/docs/client/cnt/folder/viewer/DocFolderContentPresenter.java (from rev 939, trunk/src/main/java/org/ourproject/kune/docs/client/cnt/folder/viewer/FolderViewerPresenter.java) =================================================================== --- trunk/src/main/java/org/ourproject/kune/docs/client/cnt/folder/viewer/FolderViewerPresenter.java 2008-11-04 15:07:14 UTC (rev 939) +++ trunk/src/main/java/org/ourproject/kune/docs/client/cnt/folder/viewer/DocFolderContentPresenter.java 2008-11-06 21:03:52 UTC (rev 942) @@ -0,0 +1,40 @@ +/* + * + * Copyright (C) 2007-2008 The kune development team (see CREDITS for details) + * This file is part of kune. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +package org.ourproject.kune.docs.client.cnt.folder.viewer; + +import org.ourproject.kune.docs.client.DocumentClientTool; +import org.ourproject.kune.platf.client.actions.ActionRegistry; +import org.ourproject.kune.platf.client.actions.toolbar.ActionContentToolbar; +import org.ourproject.kune.platf.client.dto.StateToken; +import org.ourproject.kune.platf.client.state.Session; +import org.ourproject.kune.platf.client.state.StateManager; +import org.ourproject.kune.workspace.client.cnt.FoldableContentPresenter; + +public class DocFolderContentPresenter extends FoldableContentPresenter implements DocFolderContent { + + public DocFolderContentPresenter(StateManager stateManager, Session session, ActionContentToolbar toolbar, + final ActionRegistry<StateToken> actionRegistry) { + super(DocumentClientTool.NAME, stateManager, session, toolbar, actionRegistry); + } + + public void init(final DocFolderContentView view) { + super.init(view); + } +} Property changes on: trunk/src/main/java/org/ourproject/kune/docs/client/cnt/folder/viewer/DocFolderContentPresenter.java ___________________________________________________________________ Name: svn:mergeinfo + Copied: trunk/src/main/java/org/ourproject/kune/docs/client/cnt/folder/viewer/DocFolderContentView.java (from rev 939, trunk/src/main/java/org/ourproject/kune/docs/client/cnt/folder/viewer/FolderViewerView.java) =================================================================== --- trunk/src/main/java/org/ourproject/kune/docs/client/cnt/folder/viewer/FolderViewerView.java 2008-11-04 15:07:14 UTC (rev 939) +++ trunk/src/main/java/org/ourproject/kune/docs/client/cnt/folder/viewer/DocFolderContentView.java 2008-11-06 21:03:52 UTC (rev 942) @@ -0,0 +1,25 @@ +/* + * + * Copyright (C) 2007-2008 The kune development team (see CREDITS for details) + * This file is part of kune. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +package org.ourproject.kune.docs.client.cnt.folder.viewer; + +import org.ourproject.kune.workspace.client.cnt.AbstractContentView; + +public interface DocFolderContentView extends AbstractContentView { +} Property changes on: trunk/src/main/java/org/ourproject/kune/docs/client/cnt/folder/viewer/DocFolderContentView.java ___________________________________________________________________ Name: svn:mergeinfo + Deleted: trunk/src/main/java/org/ourproject/kune/docs/client/cnt/folder/viewer/FolderViewer.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/docs/client/cnt/folder/viewer/FolderViewer.java 2008-11-06 00:35:01 UTC (rev 941) +++ trunk/src/main/java/org/ourproject/kune/docs/client/cnt/folder/viewer/FolderViewer.java 2008-11-06 21:03:52 UTC (rev 942) @@ -1,29 +0,0 @@ -/* - * - * Copyright (C) 2007-2008 The kune development team (see CREDITS for details) - * This file is part of kune. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ -package org.ourproject.kune.docs.client.cnt.folder.viewer; - -import org.ourproject.kune.platf.client.View; -import org.ourproject.kune.platf.client.dto.ContainerDTO; - -public interface FolderViewer { - void setFolder(ContainerDTO folder); - - View getView(); -} Deleted: trunk/src/main/java/org/ourproject/kune/docs/client/cnt/folder/viewer/FolderViewerPanel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/docs/client/cnt/folder/viewer/FolderViewerPanel.java 2008-11-06 00:35:01 UTC (rev 941) +++ trunk/src/main/java/org/ourproject/kune/docs/client/cnt/folder/viewer/FolderViewerPanel.java 2008-11-06 21:03:52 UTC (rev 942) @@ -1,33 +0,0 @@ -/* - * - * Copyright (C) 2007-2008 The kune development team (see CREDITS for details) - * This file is part of kune. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ -package org.ourproject.kune.docs.client.cnt.folder.viewer; - -import org.ourproject.kune.workspace.client.site.Site; - -import com.google.gwt.user.client.ui.Label; - -public class FolderViewerPanel extends Label implements FolderViewerView { - - public FolderViewerPanel() { - super("Folder properties, translations ..." + Site.IN_DEVELOPMENT); - super.setStyleName("kune-Content-Main"); - super.addStyleName("kune-Margin-7-trbl"); - } -} Deleted: trunk/src/main/java/org/ourproject/kune/docs/client/cnt/folder/viewer/FolderViewerPresenter.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/docs/client/cnt/folder/viewer/FolderViewerPresenter.java 2008-11-06 00:35:01 UTC (rev 941) +++ trunk/src/main/java/org/ourproject/kune/docs/client/cnt/folder/viewer/FolderViewerPresenter.java 2008-11-06 21:03:52 UTC (rev 942) @@ -1,39 +0,0 @@ -/* - * - * Copyright (C) 2007-2008 The kune development team (see CREDITS for details) - * This file is part of kune. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ -package org.ourproject.kune.docs.client.cnt.folder.viewer; - -import org.ourproject.kune.platf.client.View; -import org.ourproject.kune.platf.client.dto.ContainerDTO; - -public class FolderViewerPresenter implements FolderViewer { - - private final FolderViewerView view; - - public FolderViewerPresenter(final FolderViewerView view) { - this.view = view; - } - - public View getView() { - return view; - } - - public void setFolder(final ContainerDTO folder) { - } -} Deleted: trunk/src/main/java/org/ourproject/kune/docs/client/cnt/folder/viewer/FolderViewerView.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/docs/client/cnt/folder/viewer/FolderViewerView.java 2008-11-06 00:35:01 UTC (rev 941) +++ trunk/src/main/java/org/ourproject/kune/docs/client/cnt/folder/viewer/FolderViewerView.java 2008-11-06 21:03:52 UTC (rev 942) @@ -1,26 +0,0 @@ -/* - * - * Copyright (C) 2007-2008 The kune development team (see CREDITS for details) - * This file is part of kune. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ -package org.ourproject.kune.docs.client.cnt.folder.viewer; - -import org.ourproject.kune.platf.client.View; - -public interface FolderViewerView extends View { - -} Added: trunk/src/main/java/org/ourproject/kune/platf/client/actions/toolbar/ActionContentToolbar.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/actions/toolbar/ActionContentToolbar.java 2008-11-06 00:35:01 UTC (rev 941) +++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/toolbar/ActionContentToolbar.java 2008-11-06 21:03:52 UTC (rev 942) @@ -0,0 +1,7 @@ +package org.ourproject.kune.platf.client.actions.toolbar; + +import org.ourproject.kune.platf.client.dto.StateToken; + +public interface ActionContentToolbar extends ActionToolbar<StateToken> { + +} Added: trunk/src/main/java/org/ourproject/kune/platf/client/actions/toolbar/ActionContentToolbarPresenter.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/actions/toolbar/ActionContentToolbarPresenter.java 2008-11-06 00:35:01 UTC (rev 941) +++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/toolbar/ActionContentToolbarPresenter.java 2008-11-06 21:03:52 UTC (rev 942) @@ -0,0 +1,11 @@ +package org.ourproject.kune.platf.client.actions.toolbar; + +import org.ourproject.kune.platf.client.dto.StateToken; + +public class ActionContentToolbarPresenter extends ActionToolbarPresenter<StateToken> implements ActionContentToolbar { + + public ActionContentToolbarPresenter(ActionToolbarView<StateToken> toolbar) { + super(toolbar); + } + +} Added: trunk/src/main/java/org/ourproject/kune/platf/client/actions/toolbar/ActionContextToolbar.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/actions/toolbar/ActionContextToolbar.java 2008-11-06 00:35:01 UTC (rev 941) +++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/toolbar/ActionContextToolbar.java 2008-11-06 21:03:52 UTC (rev 942) @@ -0,0 +1,7 @@ +package org.ourproject.kune.platf.client.actions.toolbar; + +import org.ourproject.kune.platf.client.dto.StateToken; + +public interface ActionContextToolbar extends ActionToolbar<StateToken> { + +} Added: trunk/src/main/java/org/ourproject/kune/platf/client/actions/toolbar/ActionContextToolbarPresenter.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/actions/toolbar/ActionContextToolbarPresenter.java 2008-11-06 00:35:01 UTC (rev 941) +++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/toolbar/ActionContextToolbarPresenter.java 2008-11-06 21:03:52 UTC (rev 942) @@ -0,0 +1,11 @@ +package org.ourproject.kune.platf.client.actions.toolbar; + +import org.ourproject.kune.platf.client.dto.StateToken; + +public class ActionContextToolbarPresenter extends ActionToolbarPresenter<StateToken> implements ActionContextToolbar { + + public ActionContextToolbarPresenter(ActionToolbarView<StateToken> toolbar) { + super(toolbar); + } + +} Modified: trunk/src/main/java/org/ourproject/kune/platf/client/actions/toolbar/ActionToolbarPanel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/actions/toolbar/ActionToolbarPanel.java 2008-11-06 00:35:01 UTC (rev 941) +++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/toolbar/ActionToolbarPanel.java 2008-11-06 21:03:52 UTC (rev 942) @@ -126,11 +126,13 @@ if (!topbar.isAttached()) { switch (position) { case content: + ws.getEntityWorkspace().getContentTopBar().removeAll(); ws.getEntityWorkspace().getContentTopBar().add(topbar); ws.getEntityWorkspace().getContentBottomBar().add(bottombar); break; case context: default: + ws.getEntityWorkspace().getContextTopBar().removeAll(); ws.getEntityWorkspace().getContextTopBar().add(topbar); ws.getEntityWorkspace().getContextBottomBar().add(bottombar); } 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-11-06 00:35:01 UTC (rev 941) +++ trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneModule.java 2008-11-06 21:03:52 UTC (rev 942) @@ -25,6 +25,10 @@ import org.ourproject.kune.platf.client.actions.DragDropContentRegistry; import org.ourproject.kune.platf.client.actions.GroupActionRegistry; import org.ourproject.kune.platf.client.actions.UserActionRegistry; +import org.ourproject.kune.platf.client.actions.toolbar.ActionContentToolbar; +import org.ourproject.kune.platf.client.actions.toolbar.ActionContentToolbarPresenter; +import org.ourproject.kune.platf.client.actions.toolbar.ActionContextToolbar; +import org.ourproject.kune.platf.client.actions.toolbar.ActionContextToolbarPresenter; import org.ourproject.kune.platf.client.actions.toolbar.ActionToolbar; import org.ourproject.kune.platf.client.actions.toolbar.ActionToolbarPanel; import org.ourproject.kune.platf.client.actions.toolbar.ActionToolbarPresenter; @@ -107,6 +111,7 @@ import org.ourproject.kune.workspace.client.themes.WsThemePresenter; import org.ourproject.kune.workspace.client.title.EntityTitle; +import com.calclab.suco.client.ioc.decorator.NoDecoration; import com.calclab.suco.client.ioc.decorator.Singleton; import com.calclab.suco.client.ioc.module.AbstractModule; import com.calclab.suco.client.ioc.module.Factory; @@ -416,17 +421,32 @@ } }); + register(NoDecoration.class, new Factory<ActionContentToolbar>(ActionContentToolbar.class) { + @Override + public ActionContentToolbar create() { + final ActionToolbarPanel<StateToken> contentNavigatorToolbar = new ActionToolbarPanel<StateToken>( + ActionToolbarPanel.Position.content, $$(ActionManager.class), $(WorkspaceSkeleton.class)); + final ActionContentToolbar toolbar = new ActionContentToolbarPresenter(contentNavigatorToolbar); + return toolbar; + } + }); + + register(NoDecoration.class, new Factory<ActionContextToolbar>(ActionContextToolbar.class) { + @Override + public ActionContextToolbar create() { + final ActionToolbarPanel<StateToken> contentNavigatorToolbar = new ActionToolbarPanel<StateToken>( + ActionToolbarPanel.Position.context, $$(ActionManager.class), $(WorkspaceSkeleton.class)); + final ActionContextToolbar toolbar = new ActionContextToolbarPresenter(contentNavigatorToolbar); + return toolbar; + } + }); + register(Singleton.class, new Factory<ContextNavigator>(ContextNavigator.class) { @Override public ContextNavigator create() { - final ActionToolbarPanel<StateToken> contextNavigatorToolbar = new ActionToolbarPanel<StateToken>( - ActionToolbarPanel.Position.context, $$(ActionManager.class), $(WorkspaceSkeleton.class)); - final ActionToolbar<StateToken> toolbar = new ActionToolbarPresenter<StateToken>( - contextNavigatorToolbar); - final ContextNavigatorPresenter presenter = new ContextNavigatorPresenter($(StateManager.class), $(Session.class), $$(ContentServiceAsync.class), i18n, $(EntityTitle.class), - $(ContentIconsRegistry.class), $(DragDropContentRegistry.class), toolbar, + $(ContentIconsRegistry.class), $(DragDropContentRegistry.class), $(ActionContextToolbar.class), $(ContextActionRegistry.class), $$(FileDownloadUtils.class), true); final ContextNavigatorPanel panel = new ContextNavigatorPanel(presenter, i18n, $(WorkspaceSkeleton.class), $(ActionManager.class)); 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-11-06 00:35:01 UTC (rev 941) +++ trunk/src/main/java/org/ourproject/kune/platf/client/state/StateManagerDefault.java 2008-11-06 21:03:52 UTC (rev 942) @@ -204,9 +204,6 @@ private void checkGroupAndToolChange(final StateAbstractDTO newState) { final String previousGroup = previousToken == null ? "" : previousToken.getGroup(); final String newGroup = newState.getStateToken().getGroup(); - if (previousToken == null || !previousGroup.equals(newGroup)) { - onGroupChanged.fire(previousGroup, newGroup); - } String previousTokenTool = previousToken == null ? "" : previousToken.getTool(); String newTokenTool = newState.getStateToken().getTool(); String previousToolName = previousTokenTool == null ? "" : previousTokenTool; @@ -215,6 +212,9 @@ if (previousToken == null || previousToolName == null || !previousToolName.equals(newToolName)) { onToolChanged.fire(previousToolName, newToolName); } + if (previousToken == null || !previousGroup.equals(newGroup)) { + onGroupChanged.fire(previousGroup, newGroup); + } } private void clearResumedToken() { Added: trunk/src/main/java/org/ourproject/kune/workspace/client/cnt/AbstractContentPanel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/cnt/AbstractContentPanel.java 2008-11-06 00:35:01 UTC (rev 941) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/cnt/AbstractContentPanel.java 2008-11-06 21:03:52 UTC (rev 942) @@ -0,0 +1,30 @@ +package org.ourproject.kune.workspace.client.cnt; + +import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton; + +import com.google.gwt.user.client.ui.Widget; + +public class AbstractContentPanel { + private final WorkspaceSkeleton ws; + private Widget widget; + + public AbstractContentPanel(final WorkspaceSkeleton ws) { + this.ws = ws; + } + + public void attach() { + if (!widget.isAttached()) { + ws.getEntityWorkspace().setContent(widget); + } + } + + public void detach() { + if (widget.isAttached()) { + widget.removeFromParent(); + } + } + + public void initWidget(Widget widget) { + this.widget = widget; + } +} Added: trunk/src/main/java/org/ourproject/kune/workspace/client/cnt/AbstractContentPresenter.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/cnt/AbstractContentPresenter.java 2008-11-06 00:35:01 UTC (rev 941) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/cnt/AbstractContentPresenter.java 2008-11-06 21:03:52 UTC (rev 942) @@ -0,0 +1,22 @@ +package org.ourproject.kune.workspace.client.cnt; + +public abstract class AbstractContentPresenter { + + private AbstractContentView view; + + public AbstractContentPresenter() { + } + + public void attach() { + view.attach(); + } + + public void detach() { + view.detach(); + } + + public void init(final AbstractContentView view) { + this.view = view; + } + +} Added: trunk/src/main/java/org/ourproject/kune/workspace/client/cnt/AbstractContentView.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/cnt/AbstractContentView.java 2008-11-06 00:35:01 UTC (rev 941) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/cnt/AbstractContentView.java 2008-11-06 21:03:52 UTC (rev 942) @@ -0,0 +1,9 @@ +package org.ourproject.kune.workspace.client.cnt; + +public interface AbstractContentView { + + void attach(); + + void detach(); + +} Added: trunk/src/main/java/org/ourproject/kune/workspace/client/cnt/FoldableContentPresenter.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/cnt/FoldableContentPresenter.java 2008-11-06 00:35:01 UTC (rev 941) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/cnt/FoldableContentPresenter.java 2008-11-06 21:03:52 UTC (rev 942) @@ -0,0 +1,70 @@ +package org.ourproject.kune.workspace.client.cnt; + +import org.ourproject.kune.platf.client.actions.ActionItemCollection; +import org.ourproject.kune.platf.client.actions.ActionRegistry; +import org.ourproject.kune.platf.client.actions.toolbar.ActionContentToolbar; +import org.ourproject.kune.platf.client.dto.StateAbstractDTO; +import org.ourproject.kune.platf.client.dto.StateContainerDTO; +import org.ourproject.kune.platf.client.dto.StateContentDTO; +import org.ourproject.kune.platf.client.dto.StateToken; +import org.ourproject.kune.platf.client.state.Session; +import org.ourproject.kune.platf.client.state.StateManager; + +import com.calclab.suco.client.listener.Listener; + +public class FoldableContentPresenter extends AbstractContentPresenter { + + private final String toolName; + private final ActionRegistry<StateToken> actionRegistry; + private final Session session; + private final ActionContentToolbar toolbar; + + public FoldableContentPresenter(final String toolName, StateManager stateManager, Session session, + final ActionContentToolbar toolbar, ActionRegistry<StateToken> actionRegistry) { + this.toolName = toolName; + this.session = session; + this.toolbar = toolbar; + this.actionRegistry = actionRegistry; + stateManager.onStateChanged(new Listener<StateAbstractDTO>() { + public void onEvent(final StateAbstractDTO state) { + setState(state); + } + }); + } + + public String getToolName() { + return toolName; + } + + protected void setState(StateAbstractDTO state) { + toolbar.detach(); + if (state instanceof StateContainerDTO) { + StateContainerDTO stateCntCtx = (StateContainerDTO) state; + if (stateCntCtx.getToolName().equals(toolName)) { + // This tool + if (stateCntCtx instanceof StateContentDTO) { + setState((StateContentDTO) stateCntCtx); + } else if (stateCntCtx instanceof StateContainerDTO) { + setState(stateCntCtx); + } + } + } + } + + protected void setState(StateContainerDTO state) { + ActionItemCollection<StateToken> collection = actionRegistry.getCurrentActions(state.getStateToken(), + state.getTypeId(), session.isLogged(), state.getContainerRights(), true); + setToolbar(collection); + attach(); + } + + protected void setState(StateContentDTO state) { + } + + private void setToolbar(ActionItemCollection<StateToken> collection) { + toolbar.disableMenusAndClearButtons(); + toolbar.setActions(collection); + toolbar.attach(); + } + +}
participants (1)
-
vjrj