kune-commits
Threads by month
- ----- 2026 -----
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
November 2008
- 1 participants
- 36 discussions
10 Nov '08
Author: vjrj
Date: 2008-11-10 20:00:10 +0100 (Mon, 10 Nov 2008)
New Revision: 943
Added:
trunk/src/main/java/org/ourproject/kune/workspace/client/cnt/FoldableContentPanel.java
Removed:
trunk/src/main/java/org/ourproject/kune/docs/client/cnt/DocumentContent.java
trunk/src/main/java/org/ourproject/kune/docs/client/cnt/DocumentContentPanel.java
trunk/src/main/java/org/ourproject/kune/docs/client/cnt/DocumentContentPresenter.java
trunk/src/main/java/org/ourproject/kune/docs/client/cnt/DocumentContentView.java
Modified:
trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientModule.java
trunk/src/main/java/org/ourproject/kune/chat/client/cnt/room/ChatRoomPanel.java
trunk/src/main/java/org/ourproject/kune/chat/client/ctx/ChatContextPresenter.java
trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientActions.java
trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientModule.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/viewer/DocumentViewer.java
trunk/src/main/java/org/ourproject/kune/docs/client/cnt/viewer/DocumentViewerPanel.java
trunk/src/main/java/org/ourproject/kune/docs/client/cnt/viewer/DocumentViewerPresenter.java
trunk/src/main/java/org/ourproject/kune/docs/client/cnt/viewer/DocumentViewerView.java
trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneWorkspaceModule.java
trunk/src/main/java/org/ourproject/kune/workspace/client/cnt/AbstractContentPanel.java
trunk/src/main/java/org/ourproject/kune/workspace/client/cnt/FoldableContentPresenter.java
Log:
Incomplete - task UI tools & workspace refactorization
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 21:03:52 UTC (rev 942)
+++ trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientModule.java 2008-11-10 19:00:10 UTC (rev 943)
@@ -33,6 +33,7 @@
import org.ourproject.kune.platf.client.app.Application;
import org.ourproject.kune.platf.client.app.ToolGroup;
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.ToolSelector;
@@ -71,7 +72,8 @@
register(Singleton.class, new Factory<ChatContext>(ChatContext.class) {
@Override
public ChatContext create() {
- final ChatContextPresenter presenter = new ChatContextPresenter($$(RoomAdmin.class));
+ final ChatContextPresenter presenter = new ChatContextPresenter($(StateManager.class),
+ $$(ContextNavigator.class), $$(RoomAdmin.class));
return presenter;
}
});
@@ -90,7 +92,8 @@
final ChatRoomPresenter presenter = new ChatRoomPresenter($(StateManager.class), $(Session.class),
$(I18nUITranslationService.class), $(ActionContentToolbar.class),
$(ContentActionRegistry.class));
- final ChatRoomPanel panel = new ChatRoomPanel($(WorkspaceSkeleton.class));
+ final ChatRoomPanel panel = new ChatRoomPanel($(WorkspaceSkeleton.class),
+ $(I18nTranslationService.class));
presenter.init(panel);
return presenter;
}
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 21:03:52 UTC (rev 942)
+++ trunk/src/main/java/org/ourproject/kune/chat/client/cnt/room/ChatRoomPanel.java 2008-11-10 19:00:10 UTC (rev 943)
@@ -19,24 +19,17 @@
*/
package org.ourproject.kune.chat.client.cnt.room;
-import org.ourproject.kune.workspace.client.cnt.AbstractContentPanel;
+import org.ourproject.kune.platf.client.services.I18nTranslationService;
+import org.ourproject.kune.workspace.client.cnt.FoldableContentPanel;
import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton;
-import com.google.gwt.user.client.ui.Label;
+public class ChatRoomPanel extends FoldableContentPanel implements ChatRoomView {
-public class ChatRoomPanel extends AbstractContentPanel implements ChatRoomView {
-
- private final Label label;
-
- public ChatRoomPanel(final WorkspaceSkeleton ws) {
- super(ws);
- label = new Label();
- label.setStyleName("kune-Content-Main");
- label.addStyleName("kune-Margin-7-trbl");
- initWidget(label);
+ public ChatRoomPanel(final WorkspaceSkeleton ws, I18nTranslationService i18n) {
+ super(ws, i18n);
}
public void setInfo(String info) {
- label.setText(info);
+ setLabel(info);
}
}
Modified: trunk/src/main/java/org/ourproject/kune/chat/client/ctx/ChatContextPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/chat/client/ctx/ChatContextPresenter.java 2008-11-06 21:03:52 UTC (rev 942)
+++ trunk/src/main/java/org/ourproject/kune/chat/client/ctx/ChatContextPresenter.java 2008-11-10 19:00:10 UTC (rev 943)
@@ -21,6 +21,8 @@
import org.ourproject.kune.chat.client.ctx.room.RoomAdmin;
import org.ourproject.kune.platf.client.dto.StateContainerDTO;
+import org.ourproject.kune.platf.client.state.StateManager;
+import org.ourproject.kune.workspace.client.ctxnav.ContextNavigator;
import com.calclab.suco.client.ioc.Provider;
@@ -28,7 +30,8 @@
private final Provider<RoomAdmin> roomAdminsProvider;
- public ChatContextPresenter(final Provider<RoomAdmin> roomAdminsProvider) {
+ public ChatContextPresenter(final StateManager stateManager,
+ final Provider<ContextNavigator> contextNavigatorProvider, final Provider<RoomAdmin> roomAdminsProvider) {
this.roomAdminsProvider = roomAdminsProvider;
}
Modified: trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientActions.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientActions.java 2008-11-06 21:03:52 UTC (rev 942)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientActions.java 2008-11-10 19:00:10 UTC (rev 943)
@@ -28,7 +28,7 @@
import static org.ourproject.kune.docs.client.DocumentClientTool.TYPE_WIKI;
import static org.ourproject.kune.docs.client.DocumentClientTool.TYPE_WIKIPAGE;
-import org.ourproject.kune.docs.client.cnt.DocumentContent;
+import org.ourproject.kune.docs.client.cnt.viewer.DocumentViewer;
import org.ourproject.kune.docs.client.ctx.admin.DocContextEditor;
import org.ourproject.kune.platf.client.actions.ActionEnableCondition;
import org.ourproject.kune.platf.client.actions.ActionMenuItemDescriptor;
@@ -86,7 +86,7 @@
private final EntityLogo entityLogo;
private final Provider<TextEditor> textEditorProvider;
private final KuneErrorHandler errorHandler;
- private final DocumentContent documentContent;
+ private final DocumentViewer documentViewer;
private final Provider<DocContextEditor> adminContextProvider;
public DocumentClientActions(final I18nUITranslationService i18n, final ContextNavigator contextNavigator,
@@ -96,7 +96,7 @@
final ContentActionRegistry contentActionRegistry, final ContextActionRegistry contextActionRegistry,
final Provider<FileDownloadUtils> fileDownloadProvider, final EntityLogo entityLogo,
final Provider<TextEditor> textEditorProvider, final KuneErrorHandler errorHandler,
- final DocumentContent documentContent, final Provider<DocContextEditor> adminContextProvider) {
+ final DocumentViewer documentViewer, final Provider<DocContextEditor> adminContextProvider) {
this.i18n = i18n;
this.contextNavigator = contextNavigator;
this.session = session;
@@ -110,7 +110,7 @@
this.entityLogo = entityLogo;
this.textEditorProvider = textEditorProvider;
this.errorHandler = errorHandler;
- this.documentContent = documentContent;
+ this.documentViewer = documentViewer;
this.adminContextProvider = adminContextProvider;
createActions();
}
@@ -337,7 +337,7 @@
session.check(new AsyncCallbackSimple<Object>() {
public void onSuccess(final Object result) {
final TextEditor editor = textEditorProvider.get();
- documentContent.detach();
+ documentViewer.detach();
contextNavigator.detach();
adminContextProvider.get().attach();
editor.editContent(session.getContentState().getContent(), new Listener<String>() {
@@ -370,11 +370,11 @@
// onClose
DeferredCommand.addCommand(new Command() {
public void execute() {
- documentContent.attach();
+ documentViewer.attach();
adminContextProvider.get().detach();
contextNavigator.attach();
if (session.getCurrentStateToken().equals(stateToken)) {
- documentContent.refreshState();
+ documentViewer.refreshState();
}
}
});
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 21:03:52 UTC (rev 942)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientModule.java 2008-11-10 19:00:10 UTC (rev 943)
@@ -18,9 +18,6 @@
*
*/package org.ourproject.kune.docs.client;
-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.DocFolderContent;
import org.ourproject.kune.docs.client.cnt.folder.viewer.DocFolderContentPanel;
import org.ourproject.kune.docs.client.cnt.folder.viewer.DocFolderContentPresenter;
@@ -86,23 +83,11 @@
$(Session.class), $(StateManager.class), $$(ContentServiceAsync.class),
$$(GroupServiceAsync.class), $$(FileUploader.class), $(ContentActionRegistry.class),
$(ContextActionRegistry.class), $$(FileDownloadUtils.class), $(EntityLogo.class),
- $$(TextEditor.class), $(KuneErrorHandler.class), $(DocumentContent.class),
+ $$(TextEditor.class), $(KuneErrorHandler.class), $(DocumentViewer.class),
$$(DocContextEditor.class));
}
});
- register(ToolGroup.class, new Factory<DocumentContent>(DocumentContent.class) {
- @Override
- public DocumentContent create() {
- final DocumentContentPresenter presenter = new DocumentContentPresenter($(StateManager.class),
- $(Session.class), $$(DocumentViewer.class), $$(TextEditor.class),
- $(ActionContentToolbar.class), $(ContentActionRegistry.class));
- final DocumentContentPanel panel = new DocumentContentPanel($(WorkspaceSkeleton.class));
- presenter.init(panel);
- return presenter;
- }
- });
-
register(Singleton.class, new Factory<DocContextEditor>(DocContextEditor.class) {
@Override
public DocContextEditor create() {
@@ -128,9 +113,12 @@
register(Singleton.class, new Factory<DocumentViewer>(DocumentViewer.class) {
@Override
public DocumentViewer create() {
+ final DocumentViewerPresenter presenter = new DocumentViewerPresenter($(StateManager.class),
+ $(Session.class), $(I18nUITranslationService.class), $(ActionContentToolbar.class),
+ $(ContentActionRegistry.class), $$(FileDownloadUtils.class));
final DocumentViewerView view = new DocumentViewerPanel($(WorkspaceSkeleton.class),
$(I18nTranslationService.class));
- final DocumentViewerPresenter presenter = new DocumentViewerPresenter(view, $$(FileDownloadUtils.class));
+ presenter.init(view);
return presenter;
}
});
@@ -140,7 +128,8 @@
public DocFolderContent create() {
final DocFolderContentPresenter presenter = new DocFolderContentPresenter($(StateManager.class),
$(Session.class), $(ActionContentToolbar.class), $(ContentActionRegistry.class));
- final DocFolderContentView view = new DocFolderContentPanel($(WorkspaceSkeleton.class));
+ final DocFolderContentView view = new DocFolderContentPanel($(WorkspaceSkeleton.class),
+ $(I18nTranslationService.class));
presenter.init(view);
return presenter;
}
Deleted: trunk/src/main/java/org/ourproject/kune/docs/client/cnt/DocumentContent.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/cnt/DocumentContent.java 2008-11-06 21:03:52 UTC (rev 942)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/cnt/DocumentContent.java 2008-11-10 19:00:10 UTC (rev 943)
@@ -1,30 +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;
-
-public interface DocumentContent {
-
- void attach();
-
- void detach();
-
- void refreshState();
-
-}
Deleted: trunk/src/main/java/org/ourproject/kune/docs/client/cnt/DocumentContentPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/cnt/DocumentContentPanel.java 2008-11-06 21:03:52 UTC (rev 942)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/cnt/DocumentContentPanel.java 2008-11-10 19:00:10 UTC (rev 943)
@@ -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.docs.client.cnt;
-
-import org.ourproject.kune.platf.client.View;
-import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton;
-
-import com.google.gwt.user.client.ui.Widget;
-
-public class DocumentContentPanel implements DocumentContentView {
-
- private final WorkspaceSkeleton ws;
-
- public DocumentContentPanel(final WorkspaceSkeleton ws) {
- this.ws = ws;
- }
-
- public void setContent(final View view) {
- ws.getEntityWorkspace().setContent((Widget) view);
- }
-}
Deleted: 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 21:03:52 UTC (rev 942)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/cnt/DocumentContentPresenter.java 2008-11-10 19:00:10 UTC (rev 943)
@@ -1,113 +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;
-
-import org.ourproject.kune.docs.client.DocumentClientTool;
-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;
-import org.ourproject.kune.platf.client.actions.toolbar.ActionToolbar;
-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 org.ourproject.kune.workspace.client.editor.TextEditor;
-
-import com.calclab.suco.client.ioc.Provider;
-import com.calclab.suco.client.listener.Listener;
-import com.calclab.suco.client.listener.Listener2;
-
-public class DocumentContentPresenter implements DocumentContent {
- private DocumentContentView view;
- private final Session session;
- private final Provider<DocumentViewer> docReaderProvider;
- private final Provider<TextEditor> textEditorProvider;
- 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 ActionToolbar<StateToken> toolbar, final ActionRegistry<StateToken> actionRegistry) {
- this.session = session;
- this.docReaderProvider = docReaderProvider;
- this.textEditorProvider = textEditorProvider;
- this.toolbar = toolbar;
- this.actionRegistry = actionRegistry;
- stateManager.onStateChanged(new Listener<StateAbstractDTO>() {
- public void onEvent(final StateAbstractDTO state) {
- setState(state);
- }
- });
- stateManager.onToolChanged(new Listener2<String, String>() {
- public void onEvent(final String oldTool, final String newTool) {
- if (oldTool != null && oldTool.equals(DocumentClientTool.NAME)) {
- toolbar.detach();
- }
- }
- });
- }
-
- public void attach() {
- toolbar.attach();
- }
-
- public void detach() {
- toolbar.detach();
- }
-
- public void init(final DocumentContentView view) {
- this.view = view;
- }
-
- public void refreshState() {
- setState(session.getCurrentState());
- }
-
- private void setState(final StateAbstractDTO state) {
- if (state instanceof StateContainerDTO) {
- StateContainerDTO stateCntCtx = (StateContainerDTO) state;
- if (stateCntCtx.getToolName().equals(DocumentClientTool.NAME)) {
- // This tool
- if (stateCntCtx instanceof StateContentDTO) {
- setState((StateContentDTO) stateCntCtx);
- } else if (stateCntCtx instanceof StateContainerDTO) {
- // FIXME setState(stateCntCtx);
- }
- }
- }
- }
-
- private void setState(final StateContentDTO state) {
- ActionItemCollection<StateToken> collection = actionRegistry.getCurrentActions(state.getStateToken(),
- state.getTypeId(), session.isLogged(), state.getContentRights(), true);
- setToolbar(collection);
- docReaderProvider.get().showDocument(state.getStateToken(), state.getContent(), state.getTypeId(),
- state.getMimeType());
- textEditorProvider.get().reset();
- }
-
- private void setToolbar(ActionItemCollection<StateToken> collection) {
- toolbar.disableMenusAndClearButtons();
- toolbar.setActions(collection);
- toolbar.attach();
- }
-}
Deleted: trunk/src/main/java/org/ourproject/kune/docs/client/cnt/DocumentContentView.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/cnt/DocumentContentView.java 2008-11-06 21:03:52 UTC (rev 942)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/cnt/DocumentContentView.java 2008-11-10 19:00:10 UTC (rev 943)
@@ -1,27 +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;
-
-import org.ourproject.kune.platf.client.View;
-
-public interface DocumentContentView {
-
- void setContent(View view);
-
-}
Modified: 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/DocFolderContentPanel.java 2008-11-06 21:03:52 UTC (rev 942)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/cnt/folder/viewer/DocFolderContentPanel.java 2008-11-10 19:00:10 UTC (rev 943)
@@ -19,19 +19,15 @@
*/
package org.ourproject.kune.docs.client.cnt.folder.viewer;
-import org.ourproject.kune.workspace.client.cnt.AbstractContentPanel;
+import org.ourproject.kune.platf.client.services.I18nTranslationService;
+import org.ourproject.kune.workspace.client.cnt.FoldableContentPanel;
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 FoldableContentPanel implements DocFolderContentView {
-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);
+ public DocFolderContentPanel(WorkspaceSkeleton ws, I18nTranslationService i18n) {
+ super(ws, i18n);
+ super.setLabel("Folder properties, translations ..." + Site.IN_DEVELOPMENT);
}
}
Modified: trunk/src/main/java/org/ourproject/kune/docs/client/cnt/viewer/DocumentViewer.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/cnt/viewer/DocumentViewer.java 2008-11-06 21:03:52 UTC (rev 942)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/cnt/viewer/DocumentViewer.java 2008-11-10 19:00:10 UTC (rev 943)
@@ -19,13 +19,12 @@
*/
package org.ourproject.kune.docs.client.cnt.viewer;
-import org.ourproject.kune.platf.client.View;
-import org.ourproject.kune.platf.client.dto.BasicMimeTypeDTO;
-import org.ourproject.kune.platf.client.dto.StateToken;
-
public interface DocumentViewer {
- View getView();
+ void attach();
- void showDocument(StateToken token, String text, String typeId, BasicMimeTypeDTO mimeType);
+ void detach();
+
+ void refreshState();
+
}
Modified: trunk/src/main/java/org/ourproject/kune/docs/client/cnt/viewer/DocumentViewerPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/cnt/viewer/DocumentViewerPanel.java 2008-11-06 21:03:52 UTC (rev 942)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/cnt/viewer/DocumentViewerPanel.java 2008-11-10 19:00:10 UTC (rev 943)
@@ -20,54 +20,11 @@
package org.ourproject.kune.docs.client.cnt.viewer;
import org.ourproject.kune.platf.client.services.I18nTranslationService;
-import org.ourproject.kune.platf.client.ui.KuneUiUtils;
+import org.ourproject.kune.workspace.client.cnt.FoldableContentPanel;
import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton;
-import com.google.gwt.user.client.ui.ClickListener;
-import com.google.gwt.user.client.ui.HTML;
-import com.google.gwt.user.client.ui.Image;
-import com.google.gwt.user.client.ui.Widget;
-
-public class DocumentViewerPanel implements DocumentViewerView {
-
- private final WorkspaceSkeleton ws;
- private final I18nTranslationService i18n;
-
+public class DocumentViewerPanel extends FoldableContentPanel implements DocumentViewerView {
public DocumentViewerPanel(final WorkspaceSkeleton ws, I18nTranslationService i18n) {
- this.ws = ws;
- this.i18n = i18n;
+ super(ws, i18n);
}
-
- public void setContent(final String content) {
- final HTML html = new HTML(content);
- setDefStyle(html);
- ws.getEntityWorkspace().setContent(html);
- }
-
- public void showImage(String imageUrl, String imageResizedUrl) {
- final Image imgOrig = new Image(imageUrl);
- final Image imgResized = new Image(imageResizedUrl);
- KuneUiUtils.setQuickTip(imgOrig, i18n.t("Click to zoom out"));
- KuneUiUtils.setQuickTip(imgResized, i18n.t("Click to zoom in"));
- setDefStyle(imgOrig);
- setDefStyle(imgResized);
- imgOrig.addStyleName("kune-pointer");
- imgResized.addStyleName("kune-pointer");
- imgResized.addClickListener(new ClickListener() {
- public void onClick(Widget sender) {
- ws.getEntityWorkspace().setContent(imgOrig);
- }
- });
- imgOrig.addClickListener(new ClickListener() {
- public void onClick(Widget sender) {
- ws.getEntityWorkspace().setContent(imgResized);
- }
- });
- ws.getEntityWorkspace().setContent(imgResized);
- }
-
- private void setDefStyle(final Widget widget) {
- widget.setStyleName("kune-Content-Main");
- widget.addStyleName("kune-Margin-7-trbl");
- }
}
Modified: trunk/src/main/java/org/ourproject/kune/docs/client/cnt/viewer/DocumentViewerPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/cnt/viewer/DocumentViewerPresenter.java 2008-11-06 21:03:52 UTC (rev 942)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/cnt/viewer/DocumentViewerPresenter.java 2008-11-10 19:00:10 UTC (rev 943)
@@ -20,29 +20,47 @@
package org.ourproject.kune.docs.client.cnt.viewer;
import org.ourproject.kune.docs.client.DocumentClientTool;
-import org.ourproject.kune.platf.client.View;
+import org.ourproject.kune.platf.client.actions.ContentActionRegistry;
+import org.ourproject.kune.platf.client.actions.toolbar.ActionContentToolbar;
import org.ourproject.kune.platf.client.dto.BasicMimeTypeDTO;
+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 org.ourproject.kune.platf.client.ui.download.FileDownloadUtils;
import org.ourproject.kune.platf.client.ui.download.ImageSize;
+import org.ourproject.kune.workspace.client.cnt.FoldableContentPresenter;
+import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService;
import com.calclab.suco.client.ioc.Provider;
-public class DocumentViewerPresenter implements DocumentViewer {
- private final DocumentViewerView view;
+public class DocumentViewerPresenter extends FoldableContentPresenter implements DocumentViewer {
+ private DocumentViewerView view;
private final Provider<FileDownloadUtils> downloadProvider;
- public DocumentViewerPresenter(final DocumentViewerView view, final Provider<FileDownloadUtils> downloadProvider) {
- this.view = view;
+ public DocumentViewerPresenter(StateManager stateManager, Session session, I18nUITranslationService i18n,
+ ActionContentToolbar toolbar, ContentActionRegistry actionRegistry,
+ Provider<FileDownloadUtils> downloadProvider) {
+ super(DocumentClientTool.NAME, stateManager, session, toolbar, actionRegistry);
this.downloadProvider = downloadProvider;
}
- public View getView() {
- return view;
+ public void init(DocumentViewerView view) {
+ super.init(view);
+ this.view = view;
}
- public void showDocument(final StateToken token, final String text, final String typeId,
- final BasicMimeTypeDTO mimeType) {
+ public void refreshState() {
+ setState(session.getContentState());
+ }
+
+ @Override
+ protected void setState(StateContentDTO state) {
+ super.setState(state);
+ String typeId = state.getTypeId();
+ String text = state.getContent();
+ StateToken token = state.getStateToken();
+ BasicMimeTypeDTO mimeType = state.getMimeType();
if (typeId.equals(DocumentClientTool.TYPE_UPLOADEDFILE)) {
if (mimeType != null) {
FileDownloadUtils fileDownloadUtils = downloadProvider.get();
@@ -58,5 +76,6 @@
} else {
view.setContent(text);
}
+ view.attach();
}
}
Modified: trunk/src/main/java/org/ourproject/kune/docs/client/cnt/viewer/DocumentViewerView.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/cnt/viewer/DocumentViewerView.java 2008-11-06 21:03:52 UTC (rev 942)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/cnt/viewer/DocumentViewerView.java 2008-11-10 19:00:10 UTC (rev 943)
@@ -19,9 +19,9 @@
*/
package org.ourproject.kune.docs.client.cnt.viewer;
-import org.ourproject.kune.platf.client.View;
+import org.ourproject.kune.workspace.client.cnt.AbstractContentView;
-public interface DocumentViewerView extends View {
+public interface DocumentViewerView extends AbstractContentView {
void setContent(String content);
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneWorkspaceModule.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneWorkspaceModule.java 2008-11-06 21:03:52 UTC (rev 942)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneWorkspaceModule.java 2008-11-10 19:00:10 UTC (rev 943)
@@ -253,7 +253,8 @@
final EntityLogoPresenter presenter = new EntityLogoPresenter($(StateManager.class),
$(WsThemePresenter.class), $(Session.class));
final EntityLogoPanel panel = new EntityLogoPanel($(I18nUITranslationService.class),
- $(WorkspaceSkeleton.class), $$(FileDownloadUtils.class), $$(EntityLogoSelector.class), $(Images.class));
+ $(WorkspaceSkeleton.class), $$(FileDownloadUtils.class), $$(EntityLogoSelector.class),
+ $(Images.class));
presenter.init(panel);
return presenter;
}
Modified: 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 21:03:52 UTC (rev 942)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/cnt/AbstractContentPanel.java 2008-11-10 19:00:10 UTC (rev 943)
@@ -13,18 +13,18 @@
}
public void attach() {
- if (!widget.isAttached()) {
+ if (widget != null && !widget.isAttached()) {
ws.getEntityWorkspace().setContent(widget);
}
}
public void detach() {
- if (widget.isAttached()) {
+ if (widget != null && widget.isAttached()) {
widget.removeFromParent();
}
}
- public void initWidget(Widget widget) {
+ public void setWidget(Widget widget) {
this.widget = widget;
}
}
Added: trunk/src/main/java/org/ourproject/kune/workspace/client/cnt/FoldableContentPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/cnt/FoldableContentPanel.java 2008-11-06 21:03:52 UTC (rev 942)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/cnt/FoldableContentPanel.java 2008-11-10 19:00:10 UTC (rev 943)
@@ -0,0 +1,66 @@
+package org.ourproject.kune.workspace.client.cnt;
+
+import org.ourproject.kune.platf.client.services.I18nTranslationService;
+import org.ourproject.kune.platf.client.ui.KuneUiUtils;
+import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton;
+
+import com.google.gwt.user.client.ui.ClickListener;
+import com.google.gwt.user.client.ui.HTML;
+import com.google.gwt.user.client.ui.Image;
+import com.google.gwt.user.client.ui.Label;
+import com.google.gwt.user.client.ui.Widget;
+
+public class FoldableContentPanel extends AbstractContentPanel {
+
+ private final I18nTranslationService i18n;
+
+ public FoldableContentPanel(final WorkspaceSkeleton ws, I18nTranslationService i18n) {
+ super(ws);
+ this.i18n = i18n;
+ }
+
+ public void setContent(final String content) {
+ final HTML html = new HTML(content);
+ setDefStyle(html);
+ setWidget(html);
+ attach();
+ }
+
+ public void setLabel(String text) {
+ Label label = new Label(text);
+ setDefStyle(label);
+ setWidget(label);
+ }
+
+ public void showImage(String imageUrl, String imageResizedUrl) {
+ final Image imgOrig = new Image(imageUrl);
+ final Image imgResized = new Image(imageResizedUrl);
+ KuneUiUtils.setQuickTip(imgOrig, i18n.t("Click to zoom out"));
+ KuneUiUtils.setQuickTip(imgResized, i18n.t("Click to zoom in"));
+ setDefStyle(imgOrig);
+ setDefStyle(imgResized);
+ imgOrig.addStyleName("kune-pointer");
+ imgResized.addStyleName("kune-pointer");
+ imgResized.addClickListener(new ClickListener() {
+ public void onClick(Widget sender) {
+ detach();
+ setWidget(imgOrig);
+ attach();
+ }
+ });
+ imgOrig.addClickListener(new ClickListener() {
+ public void onClick(Widget sender) {
+ detach();
+ setWidget(imgResized);
+ attach();
+ }
+ });
+ setWidget(imgResized);
+ attach();
+ }
+
+ private void setDefStyle(final Widget widget) {
+ widget.setStyleName("kune-Content-Main");
+ widget.addStyleName("kune-Margin-7-trbl");
+ }
+}
Modified: 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 21:03:52 UTC (rev 942)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/cnt/FoldableContentPresenter.java 2008-11-10 19:00:10 UTC (rev 943)
@@ -3,6 +3,7 @@
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.AccessRightsDTO;
import org.ourproject.kune.platf.client.dto.StateAbstractDTO;
import org.ourproject.kune.platf.client.dto.StateContainerDTO;
import org.ourproject.kune.platf.client.dto.StateContentDTO;
@@ -16,7 +17,7 @@
private final String toolName;
private final ActionRegistry<StateToken> actionRegistry;
- private final Session session;
+ protected final Session session;
private final ActionContentToolbar toolbar;
public FoldableContentPresenter(final String toolName, StateManager stateManager, Session session,
@@ -52,15 +53,21 @@
}
protected void setState(StateContainerDTO state) {
- ActionItemCollection<StateToken> collection = actionRegistry.getCurrentActions(state.getStateToken(),
- state.getTypeId(), session.isLogged(), state.getContainerRights(), true);
+ ActionItemCollection<StateToken> collection = getActionCollection(state, state.getContainerRights());
setToolbar(collection);
attach();
}
protected void setState(StateContentDTO state) {
+ ActionItemCollection<StateToken> collection = getActionCollection(state, state.getContentRights());
+ setToolbar(collection);
}
+ private ActionItemCollection<StateToken> getActionCollection(StateContainerDTO state, AccessRightsDTO rights) {
+ return actionRegistry.getCurrentActions(state.getStateToken(), state.getTypeId(), session.isLogged(), rights,
+ true);
+ }
+
private void setToolbar(ActionItemCollection<StateToken> collection) {
toolbar.disableMenusAndClearButtons();
toolbar.setActions(collection);
1
0
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 kune-devel(a)lists-ourproject.org");
- }
- }
-}
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();
+ }
+
+}
1
0
Author: vjrj
Date: 2008-11-06 01:35:01 +0100 (Thu, 06 Nov 2008)
New Revision: 941
Added:
trunk/img/icons/persons/person2-60.png
trunk/src/main/java/org/ourproject/kune/platf/public/images/persons/person2-60.png
trunk/src/test/java/org/ourproject/kune/workspace/client/entitylogo/
trunk/src/test/java/org/ourproject/kune/workspace/client/entitylogo/EntityLogoPresenterTest.java
Modified:
trunk/img/icons/person.svg
trunk/src/main/java/org/ourproject/kune/platf/client/dto/GroupDTO.java
trunk/src/main/java/org/ourproject/kune/platf/client/services/Images.java
trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneWorkspaceModule.java
trunk/src/main/java/org/ourproject/kune/workspace/client/entitylogo/EntityLogoPanel.java
trunk/src/main/java/org/ourproject/kune/workspace/client/entitylogo/EntityLogoPresenter.java
trunk/src/main/java/org/ourproject/kune/workspace/client/entitylogo/EntityLogoSelectorPanel.java
trunk/src/main/java/org/ourproject/kune/workspace/client/entitylogo/EntityLogoSelectorPresenter.java
trunk/src/main/java/org/ourproject/kune/workspace/client/entitylogo/EntityLogoSelectorView.java
trunk/src/main/java/org/ourproject/kune/workspace/client/entitylogo/EntityLogoView.java
trunk/src/test/java/org/ourproject/kune/platf/integration/selenium/EntityLogoSeleniumTest.java
Log:
Complete - task Personal homepage logo
Modified: trunk/img/icons/person.svg
===================================================================
--- trunk/img/icons/person.svg 2008-11-05 22:07:07 UTC (rev 940)
+++ trunk/img/icons/person.svg 2008-11-06 00:35:01 UTC (rev 941)
@@ -45,8 +45,8 @@
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
- inkscape:window-width="1280"
- inkscape:window-height="951"
+ inkscape:window-width="1270"
+ inkscape:window-height="773"
inkscape:window-x="1280"
inkscape:window-y="25" />
<metadata
@@ -658,5 +658,34 @@
d="M 459.05116,237.9606 C 454.38897,244.83149 431.14686,253.27664 423.78848,245.95076 C 416.51844,238.7128 416.5378,226.91334 423.78848,219.65598 C 431.03916,212.39863 442.80837,212.39863 450.05905,219.65599 C 457.30973,226.91335 454.3126,230.25764 459.05116,237.9606 z"
style="fill:#da5f0e;fill-opacity:1;fill-rule:nonzero;stroke:#673030;stroke-width:5.30990171;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
</g>
+ <g
+ id="g2497"
+ transform="matrix(0.7058822,0,0,0.7059232,202.61473,-43.156624)"
+ inkscape:export-filename="/home/vjrj/proyectos/dev/kune/trunk/img/icons/persons/person2-60.png"
+ inkscape:export-xdpi="90"
+ inkscape:export-ydpi="90">
+ <path
+ inkscape:export-ydpi="90"
+ inkscape:export-xdpi="90"
+ inkscape:export-filename="/home/vjrj/proyectos/ourproject.org/kune/svn/trunk/img/group-def-icon.png"
+ sodipodi:type="arc"
+ style="opacity:1;fill:#eeaaff;fill-opacity:1;fill-rule:nonzero;stroke:#954f2c;stroke-width:1.63299322;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ id="path2499"
+ sodipodi:cx="-55.5"
+ sodipodi:cy="242.36218"
+ sodipodi:rx="12.5"
+ sodipodi:ry="12"
+ d="M -43,242.36218 A 12.5,12 0 1 1 -68,242.36218 A 12.5,12 0 1 1 -43,242.36218 z"
+ transform="matrix(3.1844753,0,0,3.3202165,608.65933,-692.76155)" />
+ <path
+ id="path2501"
+ d="M 431.92095,72.158845 C 421.73175,72.158845 411.49371,76.003865 403.72508,83.779605 C 388.30176,99.217125 388.19614,124.14781 403.39336,139.72526 C 401.23073,130.24809 403.98472,119.87609 411.35455,112.49948 C 422.75019,101.09333 441.09171,101.09333 452.48735,112.49948 C 459.85713,119.87609 462.61117,130.24809 460.44854,139.72526 C 475.64581,124.14776 475.54025,99.217125 460.11683,83.779605 C 452.34825,76.003865 442.11016,72.158845 431.92095,72.158845 z"
+ style="fill:#dbdee3;fill-opacity:1;fill-rule:nonzero;stroke:#954f2c;stroke-width:5.30990267;stroke-linecap:butt;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
+ <path
+ style="fill:#ff9955;fill-opacity:1;fill-rule:nonzero;stroke:#784421;stroke-width:5.30990171;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ d="M 454.05116,106.46307 C 449.38897,113.33396 426.14686,121.7791 418.78848,114.45323 C 411.51844,107.21527 411.5378,95.415805 418.78848,88.158448 C 426.03916,80.901092 437.80837,80.901094 445.05905,88.158453 C 452.30973,95.415815 449.3126,98.760105 454.05116,106.46307 z"
+ id="path2503"
+ sodipodi:nodetypes="csssc" />
+ </g>
</g>
</svg>
Added: trunk/img/icons/persons/person2-60.png
===================================================================
(Binary files differ)
Property changes on: trunk/img/icons/persons/person2-60.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/dto/GroupDTO.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/dto/GroupDTO.java 2008-11-05 22:07:07 UTC (rev 940)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/dto/GroupDTO.java 2008-11-06 00:35:01 UTC (rev 941)
@@ -122,6 +122,10 @@
return getHasLogo();
}
+ public boolean isPersonalGroup() {
+ return groupType.equals(GroupType.PERSONAL);
+ }
+
public void setDefaultContent(final ContentSimpleDTO defaultContent) {
this.defaultContent = defaultContent;
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/services/Images.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/services/Images.java 2008-11-05 22:07:07 UTC (rev 940)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/services/Images.java 2008-11-06 00:35:01 UTC (rev 941)
@@ -339,6 +339,9 @@
@Resource("org/ourproject/kune/platf/public/images/opentriangle.gif")
AbstractImagePrototype opentriangle();
+ @Resource("org/ourproject/kune/platf/public/images/persons/person2-60.png")
+ AbstractImagePrototype personAvatarDef();
+
@Resource("org/ourproject/kune/platf/public/images/person-def.png")
AbstractImagePrototype personDef();
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneWorkspaceModule.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneWorkspaceModule.java 2008-11-05 22:07:07 UTC (rev 940)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneWorkspaceModule.java 2008-11-06 00:35:01 UTC (rev 941)
@@ -253,7 +253,7 @@
final EntityLogoPresenter presenter = new EntityLogoPresenter($(StateManager.class),
$(WsThemePresenter.class), $(Session.class));
final EntityLogoPanel panel = new EntityLogoPanel($(I18nUITranslationService.class),
- $(WorkspaceSkeleton.class), $$(FileDownloadUtils.class), $$(EntityLogoSelector.class));
+ $(WorkspaceSkeleton.class), $$(FileDownloadUtils.class), $$(EntityLogoSelector.class), $(Images.class));
presenter.init(panel);
return presenter;
}
Added: trunk/src/main/java/org/ourproject/kune/platf/public/images/persons/person2-60.png
===================================================================
(Binary files differ)
Property changes on: trunk/src/main/java/org/ourproject/kune/platf/public/images/persons/person2-60.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/entitylogo/EntityLogoPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/entitylogo/EntityLogoPanel.java 2008-11-05 22:07:07 UTC (rev 940)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/entitylogo/EntityLogoPanel.java 2008-11-06 00:35:01 UTC (rev 941)
@@ -24,11 +24,13 @@
import org.ourproject.kune.platf.client.dto.GroupDTO;
import org.ourproject.kune.platf.client.dto.StateToken;
import org.ourproject.kune.platf.client.services.I18nTranslationService;
+import org.ourproject.kune.platf.client.services.Images;
import org.ourproject.kune.platf.client.ui.download.FileDownloadUtils;
import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton;
import org.ourproject.kune.workspace.client.themes.WsTheme;
import com.calclab.suco.client.ioc.Provider;
+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.Image;
@@ -103,6 +105,10 @@
setLogoText("");
}
+ public void setChangeYourAvatarText() {
+ putYourLogoHL.setText(i18n.t("Change Your Avatar"));
+ }
+
public void setChangeYourLogo() {
putYourLogoHL.setText(i18n.t("Change Your Logo"));
}
@@ -112,6 +118,10 @@
logoLabel.addStyleName(LOGO_LARGE_FONT_STYLE);
}
+ public void setLogoImage(AbstractImagePrototype imageProto) {
+ imageProto.applyTo(logoImage);
+ }
+
public void setLogoImage(final String url) {
Image.prefetch(url);
logoImage.setUrl(url);
@@ -130,6 +140,10 @@
logoLabel.addStyleName(LOGO_MEDIUM_FONT_STYLE);
}
+ public void setPutYourAvatarText() {
+ putYourLogoHL.setText(i18n.t("Put Your Avatar Here"));
+ }
+
public void setPutYourLogo() {
putYourLogoHL.setText(i18n.t("Put Your Logo Here"));
}
@@ -157,21 +171,27 @@
private final Provider<EntityLogoSelector> entityLogoSelectorProvider;
private EntityTextLogo entityTextLogo;
private final I18nTranslationService i18n;
+ private final Images images;
public EntityLogoPanel(final I18nTranslationService i18n, final WorkspaceSkeleton ws,
final Provider<FileDownloadUtils> dowloadProvider,
- final Provider<EntityLogoSelector> entityLogoSelectorProvider) {
+ final Provider<EntityLogoSelector> entityLogoSelectorProvider, Images images) {
this.i18n = i18n;
this.downloadProvider = dowloadProvider;
this.entityLogoSelectorProvider = entityLogoSelectorProvider;
+ this.images = images;
ws.addToEntityMainHeader(this);
}
public void reloadImage(GroupDTO group) {
- entityTextLogo.setLogoImage(downloadProvider.get().getLogoImageUrl(group.getStateToken()) + "&nocache="
- + new Date().getTime());
+ getEntityTextLogo().setLogoImage(
+ downloadProvider.get().getLogoImageUrl(group.getStateToken()) + "&nocache=" + new Date().getTime());
}
+ public void setChangeYourAvatarText() {
+ getEntityTextLogo().setChangeYourAvatarText();
+ }
+
public void setChangeYourLogoText() {
getEntityTextLogo().setChangeYourLogo();
@@ -213,6 +233,10 @@
getEntityTextLogo().setMediumFont();
}
+ public void setPutYourAvatarText() {
+ getEntityTextLogo().setPutYourAvatarText();
+ }
+
public void setPutYourLogoText() {
getEntityTextLogo().setPutYourLogo();
}
@@ -232,6 +256,10 @@
getEntityTextLogo().addStyleDependentName(newTheme.toString());
}
+ public void showDefUserLogo() {
+ getEntityTextLogo().setLogoImage(images.personAvatarDef());
+ }
+
private EntityTextLogo getEntityTextLogo() {
if (entityTextLogo == null) {
this.entityTextLogo = new EntityTextLogo(entityLogoSelectorProvider);
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/entitylogo/EntityLogoPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/entitylogo/EntityLogoPresenter.java 2008-11-05 22:07:07 UTC (rev 940)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/entitylogo/EntityLogoPresenter.java 2008-11-06 00:35:01 UTC (rev 941)
@@ -20,6 +20,7 @@
import org.ourproject.kune.platf.client.dto.ContentSimpleDTO;
import org.ourproject.kune.platf.client.dto.GroupDTO;
+import org.ourproject.kune.platf.client.dto.GroupType;
import org.ourproject.kune.platf.client.dto.StateAbstractDTO;
import org.ourproject.kune.platf.client.state.Session;
import org.ourproject.kune.platf.client.state.StateManager;
@@ -46,14 +47,7 @@
});
stateManager.onStateChanged(new Listener<StateAbstractDTO>() {
public void onEvent(final StateAbstractDTO state) {
- final boolean isAdmin = state.getGroupRights().isAdministrable();
- if (state.getGroup().hasLogo()) {
- view.setChangeYourLogoText();
- view.setSetYourLogoVisible(isAdmin);
- } else {
- view.setPutYourLogoText();
- view.setSetYourLogoVisible(isAdmin);
- }
+ setEntityLogoLink(state);
}
});
theme.onThemeChanged(new Listener2<WsTheme, WsTheme>() {
@@ -75,21 +69,47 @@
view.reloadImage(session.getCurrentState().getGroup());
}
- private void setGroupLogo(final GroupDTO group) {
+ void setEntityLogoLink(final StateAbstractDTO state) {
+ final boolean isAdmin = state.getGroupRights().isAdministrable();
+ switch (state.getGroup().getGroupType()) {
+ case PERSONAL:
+ if (state.getGroup().hasLogo()) {
+ view.setChangeYourAvatarText();
+ } else {
+ view.setPutYourAvatarText();
+ }
+ break;
+ default:
+ if (state.getGroup().hasLogo()) {
+ view.setChangeYourLogoText();
+ } else {
+ view.setPutYourLogoText();
+ }
+ break;
+ }
+ view.setSetYourLogoVisible(isAdmin);
+ }
+
+ void setGroupLogo(final GroupDTO group) {
final ContentSimpleDTO groupFullLogo = group.getGroupFullLogo();
if (groupFullLogo != null) {
view.setFullLogo(groupFullLogo.getStateToken(), true);
} else if (group.hasLogo()) {
+ setLogoText(group.getLongName());
view.setLogoImage(group.getStateToken());
- setLogoText(group.getLongName());
view.setLogoImageVisible(true);
} else {
setLogoText(group.getLongName());
- view.setLogoImageVisible(false);
+ if (group.getGroupType().equals(GroupType.PERSONAL)) {
+ view.showDefUserLogo();
+ view.setLogoImageVisible(true);
+ } else {
+ view.setLogoImageVisible(false);
+ }
}
}
- private void setLogoText(String name) {
+ void setLogoText(String name) {
int length = name.length();
if (length <= GROUP_LARGE_NAME_LIMIT_SIZE) {
view.setLargeFont();
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/entitylogo/EntityLogoSelectorPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/entitylogo/EntityLogoSelectorPanel.java 2008-11-05 22:07:07 UTC (rev 940)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/entitylogo/EntityLogoSelectorPanel.java 2008-11-06 00:35:01 UTC (rev 941)
@@ -39,7 +39,8 @@
public class EntityLogoSelectorPanel implements EntityLogoSelectorView {
- public static final String TITLE = "Select a logo for your group";
+ public static final String NORMAL_TITLE = "Select a logo for your group";
+ public static final String PERSON_TITLE = "Select your avatar";
public static final String ICON_UPLOAD_SERVLET = "/kune/servlets/EntityLogoUploadManager";
public static final String SUBID = "k-elogoselp-subb";
public static final String CANCELID = "k-elogoselp-canb";
@@ -49,10 +50,13 @@
private final Hidden userhashField;
private final Hidden tokenField;
private final TextField file;
+ private final Label dialogInfoLabel;
+ private final I18nTranslationService i18n;
public EntityLogoSelectorPanel(final EntityLogoSelectorPresenter presenter, final WorkspaceSkeleton ws,
I18nTranslationService i18n) {
- dialog = new BasicDialogExtended(i18n.t(TITLE), true, true, 400, 200, "", i18n.t("Select"), SUBID,
+ this.i18n = i18n;
+ dialog = new BasicDialogExtended(i18n.t(NORMAL_TITLE), true, true, 400, 200, "", i18n.t("Select"), SUBID,
i18n.tWithNT("Cancel", "used in button"), CANCELID, new Listener0() {
public void onEvent() {
String filename = file.getValueAsString();
@@ -95,16 +99,8 @@
presenter.onSubmitFailed(httpStatus, responseText);
}
});
- // We will automatically resize images to 64x64 pixels. For good
- // results, start with a square image. For best results, use a 64x64
- // pixel image.
- String text = i18n.t("Select an image in your computer as the logo for this group. "
- + "For best results use a [%d]x[%d] pixel image. We will automatically resize bigger images.",
- EntityLogoView.LOGO_ICON_DEFAULT_HEIGHT, EntityLogoView.LOGO_ICON_DEFAULT_HEIGHT);
- Label label = new Label();
- label.setHtml(text + "<br/><br/>");
-
- formPanel.add(label);
+ dialogInfoLabel = new Label();
+ formPanel.add(dialogInfoLabel);
file = new TextField("File", EntityLogoView.LOGO_FORM_FIELD);
EventCallback keyListener = new EventCallback() {
public void execute(EventObject e) {
@@ -145,6 +141,22 @@
formPanel.getForm().reset();
}
+ public void setNormalGroupsLabels() {
+ dialogInfoLabel.setHtml(i18n.t("Select an image in your computer as the logo for this group. "
+ + "For best results use a [%d]x[%d] pixel image. We will automatically resize bigger images.",
+ EntityLogoView.LOGO_ICON_DEFAULT_HEIGHT, EntityLogoView.LOGO_ICON_DEFAULT_HEIGHT)
+ + "<br/><br/>");
+ dialog.setTitle(NORMAL_TITLE);
+ }
+
+ public void setPersonalGroupsLabels() {
+ dialogInfoLabel.setHtml(i18n.t("Select an image in your computer as your avatar. "
+ + "For best results use a [%d]x[%d] pixel image. We will automatically resize bigger images.",
+ EntityLogoView.LOGO_ICON_DEFAULT_HEIGHT, EntityLogoView.LOGO_ICON_DEFAULT_HEIGHT)
+ + "<br/><br/>");
+ dialog.setTitle(PERSON_TITLE);
+ }
+
public void setUploadParams(String userHash, String token) {
userhashField.setValue(userHash);
tokenField.setValue(token);
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/entitylogo/EntityLogoSelectorPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/entitylogo/EntityLogoSelectorPresenter.java 2008-11-05 22:07:07 UTC (rev 940)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/entitylogo/EntityLogoSelectorPresenter.java 2008-11-06 00:35:01 UTC (rev 941)
@@ -59,6 +59,11 @@
session.check(new AsyncCallbackSimple<Object>() {
public void onSuccess(Object result) {
view.setUploadParams(session.getUserHash(), session.getCurrentStateToken().toString());
+ if (session.getCurrentState().getGroup().isPersonalGroup()) {
+ view.setPersonalGroupsLabels();
+ } else {
+ view.setNormalGroupsLabels();
+ }
view.show();
}
});
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/entitylogo/EntityLogoSelectorView.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/entitylogo/EntityLogoSelectorView.java 2008-11-05 22:07:07 UTC (rev 940)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/entitylogo/EntityLogoSelectorView.java 2008-11-06 00:35:01 UTC (rev 941)
@@ -23,6 +23,10 @@
public interface EntityLogoSelectorView extends View {
void hide();
+ void setNormalGroupsLabels();
+
+ void setPersonalGroupsLabels();
+
void setUploadParams(String userHash, String token);
void show();
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/entitylogo/EntityLogoView.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/entitylogo/EntityLogoView.java 2008-11-05 22:07:07 UTC (rev 940)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/entitylogo/EntityLogoView.java 2008-11-06 00:35:01 UTC (rev 941)
@@ -34,6 +34,8 @@
void reloadImage(GroupDTO group);
+ void setChangeYourAvatarText();
+
void setChangeYourLogoText();
void setFullLogo(StateToken stateToken, boolean clipped);
@@ -48,6 +50,8 @@
void setMediumFont();
+ void setPutYourAvatarText();
+
void setPutYourLogoText();
void setSetYourLogoVisible(final boolean visible);
@@ -55,4 +59,6 @@
void setSmallFont();
void setTheme(final WsTheme oldTheme, WsTheme newTheme);
+
+ void showDefUserLogo();
}
Modified: trunk/src/test/java/org/ourproject/kune/platf/integration/selenium/EntityLogoSeleniumTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/integration/selenium/EntityLogoSeleniumTest.java 2008-11-05 22:07:07 UTC (rev 940)
+++ trunk/src/test/java/org/ourproject/kune/platf/integration/selenium/EntityLogoSeleniumTest.java 2008-11-06 00:35:01 UTC (rev 941)
@@ -20,7 +20,7 @@
private void setLogo(String filename) throws Exception, IOException {
click(gid(EntityLogoPanel.PUT_YOUR_LOGO_LINK));
- waitForTextInside(EntityLogoSelectorPanel.DIALOG_ID, EntityLogoSelectorPanel.TITLE);
+ waitForTextInside(EntityLogoSelectorPanel.DIALOG_ID, EntityLogoSelectorPanel.NORMAL_TITLE);
File dir = new File(".");
type(EntityLogoView.LOGO_FORM_FIELD, dir.getCanonicalPath() + File.separator + "img" + File.separator
+ filename);
Added: trunk/src/test/java/org/ourproject/kune/workspace/client/entitylogo/EntityLogoPresenterTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/workspace/client/entitylogo/EntityLogoPresenterTest.java 2008-11-05 22:07:07 UTC (rev 940)
+++ trunk/src/test/java/org/ourproject/kune/workspace/client/entitylogo/EntityLogoPresenterTest.java 2008-11-06 00:35:01 UTC (rev 941)
@@ -0,0 +1,87 @@
+package org.ourproject.kune.workspace.client.entitylogo;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mockito;
+import org.ourproject.kune.platf.client.dto.GroupDTO;
+import org.ourproject.kune.platf.client.dto.GroupType;
+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.themes.WsThemePresenter;
+
+public class EntityLogoPresenterTest {
+
+ private StateManager stateManager;
+ private Session session;
+ private EntityLogoPresenter entityLogoPresenter;
+ private EntityLogoView view;
+
+ @Before
+ public void before() {
+ stateManager = Mockito.mock(StateManager.class);
+ session = Mockito.mock(Session.class);
+ WsThemePresenter theme = Mockito.mock(WsThemePresenter.class);
+ entityLogoPresenter = new EntityLogoPresenter(stateManager, theme, session);
+ view = Mockito.mock(EntityLogoView.class);
+ entityLogoPresenter.init(view);
+ }
+
+ @Test
+ public void testCommProjectNoLogo() {
+ GroupDTO group = new GroupDTO("shortname", "longname", GroupType.COMMUNITY);
+ group.setHasLogo(false);
+ entityLogoPresenter.setGroupLogo(group);
+ Mockito.verify(view, Mockito.never()).setLogoImageVisible(true);
+ Mockito.verify(view, Mockito.times(1)).setLogoImageVisible(false);
+ Mockito.verify(view, Mockito.never()).showDefUserLogo();
+ Mockito.verify(view, Mockito.never()).setLogoImage((StateToken) Mockito.anyObject());
+ }
+
+ @Test
+ public void testCommunityWithLogo() {
+ testGroupWIthLogo(GroupType.COMMUNITY);
+ }
+
+ @Test
+ public void testOrgWithLogo() {
+ testGroupWIthLogo(GroupType.ORGANIZATION);
+ }
+
+ @Test
+ public void testOrphWithLogo() {
+ testGroupWIthLogo(GroupType.ORPHANED_PROJECT);
+ }
+
+ @Test
+ public void testPersonalGroupWithLogo() {
+ testGroupWIthLogo(GroupType.PERSONAL);
+ }
+
+ @Test
+ public void testPersonalProjectNoLogo() {
+ GroupDTO group = new GroupDTO("shortname", "longname", GroupType.PERSONAL);
+ group.setHasLogo(false);
+ entityLogoPresenter.setGroupLogo(group);
+ Mockito.verify(view, Mockito.times(1)).setLogoImageVisible(true);
+ Mockito.verify(view, Mockito.never()).setLogoImageVisible(false);
+ Mockito.verify(view, Mockito.times(1)).showDefUserLogo();
+ Mockito.verify(view, Mockito.never()).setLogoImage((StateToken) Mockito.anyObject());
+ }
+
+ @Test
+ public void testProjectWithLogo() {
+ testGroupWIthLogo(GroupType.PROJECT);
+ }
+
+ private void testGroupWIthLogo(GroupType groupType) {
+ GroupDTO group = new GroupDTO("shortname", "longname", groupType);
+ group.setHasLogo(true);
+ entityLogoPresenter.setGroupLogo(group);
+ Mockito.verify(view, Mockito.times(1)).setLogoImageVisible(true);
+ Mockito.verify(view, Mockito.never()).setLogoImageVisible(false);
+ Mockito.verify(view, Mockito.never()).showDefUserLogo();
+ Mockito.verify(view, Mockito.times(1)).setLogoImage((StateToken) Mockito.anyObject());
+ }
+
+}
1
0
Author: vjrj
Date: 2008-11-05 23:07:07 +0100 (Wed, 05 Nov 2008)
New Revision: 940
Added:
trunk/src/main/java/org/ourproject/kune/chat/client/ChatEngineDefault.java
trunk/src/main/java/org/ourproject/kune/chat/client/ctx/room/
trunk/src/main/java/org/ourproject/kune/chat/client/ctx/room/RoomAdmin.java
trunk/src/main/java/org/ourproject/kune/chat/client/ctx/room/RoomAdminPresenter.java
trunk/src/main/java/org/ourproject/kune/docs/client/cnt/viewer/
trunk/src/main/java/org/ourproject/kune/docs/client/cnt/viewer/DocumentViewer.java
trunk/src/main/java/org/ourproject/kune/docs/client/cnt/viewer/DocumentViewerPanel.java
trunk/src/main/java/org/ourproject/kune/docs/client/cnt/viewer/DocumentViewerPresenter.java
trunk/src/main/java/org/ourproject/kune/docs/client/cnt/viewer/DocumentViewerView.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/BeforeActionCollection.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/BeforeActionListener.java
trunk/src/main/java/org/ourproject/kune/platf/client/tool/FoldableAbstractClientTool.java
Removed:
trunk/src/main/java/org/ourproject/kune/app/public/css/img/chat.gif
trunk/src/main/java/org/ourproject/kune/chat/client/ChatEngineXmpp.java
trunk/src/main/java/org/ourproject/kune/chat/client/cnt/RoomViewListener.java
trunk/src/main/java/org/ourproject/kune/chat/client/cnt/RoomViewPanel.java
trunk/src/main/java/org/ourproject/kune/chat/client/cnt/info/ui/
trunk/src/main/java/org/ourproject/kune/chat/client/cnt/room/ChatRoomControl.java
trunk/src/main/java/org/ourproject/kune/chat/client/cnt/room/ChatRoomControlPanel.java
trunk/src/main/java/org/ourproject/kune/chat/client/cnt/room/ChatRoomControlPresenter.java
trunk/src/main/java/org/ourproject/kune/chat/client/cnt/room/ChatRoomControlView.java
trunk/src/main/java/org/ourproject/kune/chat/client/cnt/room/ui/
trunk/src/main/java/org/ourproject/kune/chat/client/ctx/room/RoomsAdmin.java
trunk/src/main/java/org/ourproject/kune/chat/client/ctx/room/RoomsAdminPresenter.java
trunk/src/main/java/org/ourproject/kune/chat/client/ctx/rooms/
trunk/src/main/java/org/ourproject/kune/docs/client/cnt/reader/
trunk/src/main/java/org/ourproject/kune/docs/client/cnt/viewer/DocumentReader.java
trunk/src/main/java/org/ourproject/kune/docs/client/cnt/viewer/DocumentReaderPresenter.java
trunk/src/main/java/org/ourproject/kune/docs/client/cnt/viewer/DocumentReaderView.java
trunk/src/main/java/org/ourproject/kune/docs/client/cnt/viewer/ui/
trunk/src/main/java/org/ourproject/kune/platf/client/state/BeforeActionListener.java
trunk/src/main/java/org/ourproject/kune/platf/client/state/BeforeStateChangeCollection.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/gwtcustom/
trunk/src/main/java/org/ourproject/kune/platf/public/images/chat.png
Modified:
trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientActions.java
trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientModule.java
trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientTool.java
trunk/src/main/java/org/ourproject/kune/chat/client/ChatEngine.java
trunk/src/main/java/org/ourproject/kune/chat/client/ctx/ChatContextPresenter.java
trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientModule.java
trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientTool.java
trunk/src/main/java/org/ourproject/kune/docs/client/cnt/DocumentContentPresenter.java
trunk/src/main/java/org/ourproject/kune/platf/client/services/ImageDescriptor.java
trunk/src/main/java/org/ourproject/kune/platf/client/services/ImageUtils.java
trunk/src/main/java/org/ourproject/kune/platf/client/services/Images.java
trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneModule.java
trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneWorkspaceModule.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/gridmenu/GridMenuPanel.java
trunk/src/main/java/org/ourproject/kune/workspace/client/editor/TextEditorPresenter.java
trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/sitesign/SiteSignOutLink.java
trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/sitesign/SiteSignOutLinkPresenter.java
trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/BuddiesSummaryPresenter.java
trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/GroupMembersSummaryPresenter.java
trunk/src/main/java/org/ourproject/kune/workspace/client/title/EntitySubTitlePresenter.java
trunk/src/test/java/org/ourproject/kune/platf/client/state/StateManagerTest.java
trunk/src/test/java/org/ourproject/kune/workspace/client/editor/TextEditorPresenterTest.java
Log:
Complete - task ChatEngine/Tool refactorization
Incomplete - task UI tools & workspace refactorization
Complete - task Implements beforeSignOut (to prevent unsaved docs or chat opened)
Deleted: trunk/src/main/java/org/ourproject/kune/app/public/css/img/chat.gif
===================================================================
(Binary files differ)
Modified: trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientActions.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientActions.java 2008-11-04 15:07:14 UTC (rev 939)
+++ trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientActions.java 2008-11-05 22:07:07 UTC (rev 940)
@@ -35,15 +35,19 @@
public class ChatClientActions {
private final Session session;
- private final Provider<ChatClientTool> chatClientToolProvider;
+ private final Provider<ChatEngine> chatEngineProvider;
private final ContentActionRegistry contentActionRegistry;
+ private final I18nUITranslationService i18n;
+ private final ContextActionRegistry contextActionRegistry;
public ChatClientActions(final I18nUITranslationService i18n, final Session session,
final ContentActionRegistry contentActionRegistry, final ContextActionRegistry contextActionRegistry,
- final Provider<ChatClientTool> chatClientToolProvider) {
+ final Provider<ChatEngine> chatEngine) {
+ this.i18n = i18n;
this.session = session;
this.contentActionRegistry = contentActionRegistry;
- this.chatClientToolProvider = chatClientToolProvider;
+ this.contextActionRegistry = contextActionRegistry;
+ this.chatEngineProvider = chatEngine;
createActions();
}
@@ -51,9 +55,9 @@
final ActionToolbarButtonDescriptor<StateToken> chatAbout = new ActionToolbarButtonDescriptor<StateToken>(
AccessRolDTO.Viewer, ActionToolbarPosition.topbar, new Listener<StateToken>() {
public void onEvent(final StateToken token) {
- chatClientToolProvider.get().getChat().joinRoom(token.toString().replaceAll("\\.", "-"),
+ chatEngineProvider.get().joinRoom(token.toString().replaceAll("\\.", "-"),
session.getCurrentUserInfo().getShortName());
- chatClientToolProvider.get().getChat().show();
+ chatEngineProvider.get().show();
}
});
// chatAbout.setTextDescription(i18n.t("Chat about"));
@@ -61,10 +65,33 @@
chatAbout.setToolTip("Chat and comment this");
chatAbout.setLeftSeparator(ActionToolbarButtonSeparator.fill);
+ ActionToolbarButtonDescriptor<StateToken> joinRoom = new ActionToolbarButtonDescriptor<StateToken>(
+ AccessRolDTO.Viewer, ActionToolbarPosition.topbar, new Listener<StateToken>() {
+ public void onEvent(StateToken token) {
+ chatEngineProvider.get().joinRoom(session.getContainerState().getContainer().getName(),
+ session.getCurrentUserInfo().getShortName());
+ }
+ });
+ joinRoom.setTextDescription(i18n.t("Enter room"));
+ joinRoom.setToolTip(i18n.t("Enter in this chat room"));
+ joinRoom.setMustBeAuthenticated(true);
+
+ ActionToolbarButtonDescriptor<StateToken> addRoom = new ActionToolbarButtonDescriptor<StateToken>(
+ AccessRolDTO.Administrator, ActionToolbarPosition.topbar, new Listener<StateToken>() {
+ public void onEvent(StateToken token) {
+
+ }
+ });
+ addRoom.setTextDescription(i18n.t("New room"));
+ addRoom.setToolTip(i18n.t("Create a new chat room"));
+ addRoom.setMustBeAuthenticated(true);
+
contentActionRegistry.addAction(chatAbout, DocumentClientTool.TYPE_DOCUMENT);
contentActionRegistry.addAction(chatAbout, DocumentClientTool.TYPE_GALLERY);
contentActionRegistry.addAction(chatAbout, DocumentClientTool.TYPE_WIKIPAGE);
contentActionRegistry.addAction(chatAbout, DocumentClientTool.TYPE_POST);
contentActionRegistry.addAction(chatAbout, DocumentClientTool.TYPE_UPLOADEDFILE);
+
+ contextActionRegistry.addAction(joinRoom, ChatClientTool.TYPE_ROOT);
}
}
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-04 15:07:14 UTC (rev 939)
+++ trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientModule.java 2008-11-05 22:07:07 UTC (rev 940)
@@ -23,17 +23,16 @@
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.ChatRoomControl;
-import org.ourproject.kune.chat.client.cnt.room.ChatRoomControlPanel;
-import org.ourproject.kune.chat.client.cnt.room.ChatRoomControlPresenter;
import org.ourproject.kune.chat.client.cnt.room.ChatRoomPanel;
import org.ourproject.kune.chat.client.cnt.room.ChatRoomPresenter;
import org.ourproject.kune.chat.client.ctx.ChatContext;
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.chat.client.ctx.room.RoomAdmin;
+import org.ourproject.kune.chat.client.ctx.room.RoomAdminPresenter;
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.app.Application;
import org.ourproject.kune.platf.client.app.ToolGroup;
import org.ourproject.kune.platf.client.rpc.ContentServiceAsync;
@@ -43,7 +42,6 @@
import org.ourproject.kune.workspace.client.ctxnav.ContextNavigator;
import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService;
import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton;
-import org.ourproject.kune.workspace.client.socialnet.GroupMembersSummary;
import org.ourproject.kune.workspace.client.themes.WsThemePresenter;
import com.calclab.emiteuimodule.client.EmiteUIDialog;
@@ -60,16 +58,16 @@
@Override
public ChatClientActions create() {
return new ChatClientActions($(I18nUITranslationService.class), $(Session.class),
- $(ContentActionRegistry.class), $(ContextActionRegistry.class), $$(ChatClientTool.class));
+ $(ContentActionRegistry.class), $(ContextActionRegistry.class), $$(ChatEngine.class));
}
});
register(ToolGroup.class, new Factory<ChatClientTool>(ChatClientTool.class) {
@Override
public ChatClientTool create() {
- return new ChatClientTool($(Session.class), $(Application.class), $(I18nUITranslationService.class),
- $(EmiteUIDialog.class), $(WorkspaceSkeleton.class), $$(GroupMembersSummary.class),
- $(ToolSelector.class), $(WsThemePresenter.class), $$(ChatContent.class), $$(ChatContext.class));
+ return new ChatClientTool($(I18nUITranslationService.class), $(WorkspaceSkeleton.class),
+ $(ToolSelector.class), $(WsThemePresenter.class), $(ContentIconsRegistry.class),
+ $(DragDropContentRegistry.class));
}
});
@@ -92,19 +90,16 @@
register(Singleton.class, new Factory<ChatContext>(ChatContext.class) {
@Override
public ChatContext create() {
- final ChatContextPresenter presenter = new ChatContextPresenter($$(RoomsAdmin.class));
+ final ChatContextPresenter presenter = new ChatContextPresenter($$(RoomAdmin.class));
return presenter;
}
});
- register(Singleton.class, new Factory<ChatRoomControl>(ChatRoomControl.class) {
+ register(Singleton.class, new Factory<ChatEngine>(ChatEngine.class) {
@Override
- public ChatRoomControl create() {
- final ChatRoomControlPresenter presenter = new ChatRoomControlPresenter();
- final ChatRoomControlPanel panel = new ChatRoomControlPanel($(I18nUITranslationService.class),
- presenter);
- presenter.init(panel);
- return presenter;
+ public ChatEngine create() {
+ return new ChatEngineDefault($(I18nUITranslationService.class), $(WorkspaceSkeleton.class),
+ $(Application.class), $(Session.class), $$(EmiteUIDialog.class));
}
});
@@ -117,10 +112,10 @@
}
});
- register(Singleton.class, new Factory<RoomsAdmin>(RoomsAdmin.class) {
+ register(Singleton.class, new Factory<RoomAdmin>(RoomAdmin.class) {
@Override
- public RoomsAdmin create() {
- final RoomsAdminPresenter presenter = new RoomsAdminPresenter($(ContextNavigator.class),
+ public RoomAdmin create() {
+ final RoomAdminPresenter presenter = new RoomAdminPresenter($(ContextNavigator.class),
$(I18nUITranslationService.class), $$(StateManager.class), $(Session.class),
$$(ContentServiceAsync.class));
return presenter;
Modified: trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientTool.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientTool.java 2008-11-04 15:07:14 UTC (rev 939)
+++ trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientTool.java 2008-11-05 22:07:07 UTC (rev 940)
@@ -19,109 +19,33 @@
*/
package org.ourproject.kune.chat.client;
-import org.ourproject.kune.chat.client.cnt.ChatContent;
-import org.ourproject.kune.chat.client.ctx.ChatContext;
-import org.ourproject.kune.platf.client.app.Application;
-import org.ourproject.kune.platf.client.dto.GroupDTO;
-import org.ourproject.kune.platf.client.dto.InitDataDTO;
-import org.ourproject.kune.platf.client.dto.StateContainerDTO;
-import org.ourproject.kune.platf.client.dto.UserInfoDTO;
+import org.ourproject.kune.platf.client.actions.ContentIconsRegistry;
+import org.ourproject.kune.platf.client.actions.DragDropContentRegistry;
import org.ourproject.kune.platf.client.services.I18nTranslationService;
-import org.ourproject.kune.platf.client.state.Session;
-import org.ourproject.kune.platf.client.tool.AbstractClientTool;
+import org.ourproject.kune.platf.client.tool.FoldableAbstractClientTool;
import org.ourproject.kune.platf.client.tool.ToolSelector;
-import org.ourproject.kune.platf.client.ui.MenuItem;
-import org.ourproject.kune.platf.client.ui.WindowUtils;
import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton;
-import org.ourproject.kune.workspace.client.socialnet.GroupMembersSummary;
import org.ourproject.kune.workspace.client.themes.WsThemePresenter;
-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;
-import com.calclab.suco.client.listener.Listener;
-import com.calclab.suco.client.listener.Listener0;
-
-public class ChatClientTool extends AbstractClientTool {
+public class ChatClientTool extends FoldableAbstractClientTool {
public static final String NAME = "chats";
public static final String TYPE_ROOT = "chat.root";
public static final String TYPE_ROOM = "chat.room";
public static final String TYPE_CHAT = "chat.chat";
- private ChatEngine chat;
- private final Provider<ChatContext> chatContextProvider;
- private final Provider<ChatContent> chatContentProvider;
- public ChatClientTool(final Session session, final Application application, final I18nTranslationService i18n,
- final EmiteUIDialog emiteUIDialog, final WorkspaceSkeleton ws,
- final Provider<GroupMembersSummary> groupMembersSummaryProvider, final ToolSelector toolSelector,
- final WsThemePresenter wsThemePresenter, final Provider<ChatContent> chatContentProvider,
- final Provider<ChatContext> chatContextProvider) {
- super(NAME, i18n.t("chat rooms"), toolSelector, wsThemePresenter, ws);
- this.chatContentProvider = chatContentProvider;
- this.chatContextProvider = chatContextProvider;
- session.onInitDataReceived(new Listener<InitDataDTO>() {
- public void onEvent(final InitDataDTO initData) {
- checkChatDomain(initData.getChatDomain());
- final ChatConnectionOptions chatOptions = new ChatConnectionOptions(initData.getChatHttpBase(),
- initData.getChatDomain(), initData.getChatRoomHost());
- chat = new ChatEngineXmpp(emiteUIDialog, chatOptions, i18n, ws);
- groupMembersSummaryProvider.get().addUserOperation(
- new MenuItem<GroupDTO>("images/new-chat.gif", i18n.t("Start a chat with this member"),
- new Listener<GroupDTO>() {
- public void onEvent(final GroupDTO group) {
- emiteUIDialog.show();
- if (emiteUIDialog.isLoggedIn()) {
- emiteUIDialog.chat(XmppURI.jid(group.getShortName() + "@"
- + initData.getChatDomain()));
- } else {
- ws.showAlertMessage(i18n.t("Error"),
- i18n.t("To start a chat you need to be 'online'."));
- }
- }
- }), true);
- }
-
- private void checkChatDomain(final String chatDomain) {
- final String httpDomain = WindowUtils.getLocation().getHostName();
- if (!chatDomain.equals(httpDomain)) {
- Log.error("Your http domain (" + httpDomain + ") is different from the chat domain (" + chatDomain
- + "). This will produce problems with the chat functionality. "
- + "Check kune.properties on the server.");
- }
- }
- });
- application.onApplicationStop(new Listener0() {
- public void onEvent() {
- chat.stop();
- }
- });
- session.onUserSignOut(new Listener0() {
- public void onEvent() {
- chat.logout();
- }
- });
- session.onUserSignIn(new Listener<UserInfoDTO>() {
- public void onEvent(final UserInfoDTO user) {
- chat.login(user.getChatName(), user.getChatPassword());
- }
- });
+ public ChatClientTool(final I18nTranslationService i18n, final WorkspaceSkeleton ws,
+ final ToolSelector toolSelector, final WsThemePresenter wsThemePresenter,
+ final ContentIconsRegistry contentIconsRegistry, final DragDropContentRegistry dragDropContentRegistry) {
+ super(NAME, i18n.t("chat rooms"), toolSelector, wsThemePresenter, ws, contentIconsRegistry,
+ dragDropContentRegistry);
}
- public ChatEngine getChat() {
- return chat;
- }
-
public String getName() {
return NAME;
}
- public void setContent(final StateContainerDTO state) {
- chatContentProvider.get().setState(state);
+ @Override
+ protected void registerIcons() {
+ contentIconsRegistry.registerContentTypeIcon(TYPE_ROOM, "public/images/emite-room.png");
}
-
- public void setContext(final StateContainerDTO state) {
- chatContextProvider.get().setState(state);
- }
-
}
Modified: trunk/src/main/java/org/ourproject/kune/chat/client/ChatEngine.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/chat/client/ChatEngine.java 2008-11-04 15:07:14 UTC (rev 939)
+++ trunk/src/main/java/org/ourproject/kune/chat/client/ChatEngine.java 2008-11-05 22:07:07 UTC (rev 940)
@@ -19,11 +19,18 @@
*/
package org.ourproject.kune.chat.client;
+import com.calclab.emite.core.client.xmpp.stanzas.XmppURI;
+
public interface ChatEngine {
+
void addNewBuddie(String shortName);
+ void chat(XmppURI jid);
+
ChatConnectionOptions getChatOptions();
+ boolean isLoggedIn();
+
void joinRoom(String roomName, String userAlias);
void login(String jid, String passwd);
@@ -33,4 +40,5 @@
void show();
void stop();
+
}
Copied: trunk/src/main/java/org/ourproject/kune/chat/client/ChatEngineDefault.java (from rev 939, trunk/src/main/java/org/ourproject/kune/chat/client/ChatEngineXmpp.java)
===================================================================
--- trunk/src/main/java/org/ourproject/kune/chat/client/ChatEngineXmpp.java 2008-11-04 15:07:14 UTC (rev 939)
+++ trunk/src/main/java/org/ourproject/kune/chat/client/ChatEngineDefault.java 2008-11-05 22:07:07 UTC (rev 940)
@@ -0,0 +1,207 @@
+/*
+ *
+ * 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 java.util.Date;
+
+import org.ourproject.kune.platf.client.app.Application;
+import org.ourproject.kune.platf.client.dto.InitDataDTO;
+import org.ourproject.kune.platf.client.dto.UserInfoDTO;
+import org.ourproject.kune.platf.client.services.I18nTranslationService;
+import org.ourproject.kune.platf.client.state.Session;
+import org.ourproject.kune.platf.client.ui.WindowUtils;
+import org.ourproject.kune.workspace.client.site.Site;
+import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton;
+
+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.emiteuimodule.client.SubscriptionMode;
+import com.calclab.emiteuimodule.client.UserChatOptions;
+import com.calclab.emiteuimodule.client.params.AvatarProvider;
+import com.calclab.emiteuimodule.client.status.OwnPresence.OwnStatus;
+import com.calclab.suco.client.ioc.Provider;
+import com.calclab.suco.client.listener.Listener;
+import com.calclab.suco.client.listener.Listener0;
+import com.google.gwt.user.client.Window;
+import com.gwtext.client.core.EventObject;
+import com.gwtext.client.widgets.Button;
+import com.gwtext.client.widgets.ToolbarButton;
+import com.gwtext.client.widgets.event.ButtonListenerAdapter;
+
+class ChatEngineDefault implements ChatEngine {
+ private ChatConnectionOptions chatOptions;
+ private final I18nTranslationService i18n;
+ private final WorkspaceSkeleton ws;
+ private ToolbarButton traybarButton;
+ private final Provider<EmiteUIDialog> emiteUIProvider;
+
+ public ChatEngineDefault(final I18nTranslationService i18n, final WorkspaceSkeleton ws, Application application,
+ Session session, final Provider<EmiteUIDialog> emiteUIProvider) {
+ this.i18n = i18n;
+ this.ws = ws;
+ this.emiteUIProvider = emiteUIProvider;
+ session.onInitDataReceived(new Listener<InitDataDTO>() {
+ public void onEvent(final InitDataDTO initData) {
+ checkChatDomain(initData.getChatDomain());
+ chatOptions = new ChatConnectionOptions(initData.getChatHttpBase(), initData.getChatDomain(),
+ initData.getChatRoomHost());
+ }
+
+ private void checkChatDomain(final String chatDomain) {
+ final String httpDomain = WindowUtils.getLocation().getHostName();
+ if (!chatDomain.equals(httpDomain)) {
+ Log.error("Your http domain (" + httpDomain + ") is different from the chat domain (" + chatDomain
+ + "). This will produce problems with the chat functionality. "
+ + "Check kune.properties on the server.");
+ }
+ }
+ });
+ session.onUserSignOut(new Listener0() {
+ public void onEvent() {
+ logout();
+ }
+ });
+ session.onUserSignIn(new Listener<UserInfoDTO>() {
+ public void onEvent(final UserInfoDTO user) {
+ login(user.getChatName(), user.getChatPassword());
+ }
+ });
+ application.onApplicationStop(new Listener0() {
+ public void onEvent() {
+ stop();
+ }
+ });
+ }
+
+ public void addNewBuddie(String shortName) {
+ Site.important("In development (emite)");
+ }
+
+ public void chat(XmppURI jid) {
+ emiteUIProvider.get().chat(jid);
+ }
+
+ public ChatConnectionOptions getChatOptions() {
+ return chatOptions;
+ }
+
+ public boolean isLoggedIn() {
+ return emiteUIProvider.get().isLoggedIn();
+ }
+
+ public void joinRoom(final String roomName, final String userAlias) {
+ if (emiteUIProvider.get().isLoggedIn()) {
+ final XmppURI roomURI = XmppURI.uri(roomName + "@" + chatOptions.roomHost + "/"
+ + chatOptions.userOptions.getUserJid().getNode());
+ emiteUIProvider.get().joinRoom(roomURI);
+ } else {
+ ws.showAlertMessage(i18n.t("Error"), i18n.t("To join a chatroom you need to be 'online'."));
+ }
+ }
+
+ public void login(final String jid, final String passwd) {
+ final UserChatOptions userChatOptions = getUserChatOptions(jid, passwd);
+ // FIXME: Avatar provider
+ final AvatarProvider avatarProvider = new AvatarProvider() {
+ public String getAvatarURL(XmppURI userURI) {
+ return "images/person-def.gif";
+ }
+ };
+ final String initialWindowTitle = Window.getTitle();
+ chatOptions.userOptions = userChatOptions;
+ if (emiteUIProvider.get().isDialogNotStarted()) {
+ emiteUIProvider.get().start(userChatOptions, chatOptions.httpBase, chatOptions.roomHost,
+ initialWindowTitle, avatarProvider, i18n.t("Chat"));
+ } else {
+ emiteUIProvider.get().setEnableStatusUI(true);
+ emiteUIProvider.get().refreshUserInfo(chatOptions.userOptions);
+ }
+ emiteUIProvider.get().show(OwnStatus.online);
+ if (traybarButton == null) {
+ traybarButton = new ToolbarButton();
+ traybarButton.setTooltip(i18n.t("Show/hide the chat window"));
+ // traybarButton.setIcon("images/emite-chat.gif");
+ traybarButton.setIcon("images/e-icon.gif");
+ traybarButton.addListener(new ButtonListenerAdapter() {
+ @Override
+ public void onClick(final Button button, final EventObject e) {
+ if (emiteUIProvider.get().isVisible()) {
+ emiteUIProvider.get().hide();
+ } else {
+ emiteUIProvider.get().show();
+ }
+ }
+ });
+ ws.getSiteTraybar().addButton(traybarButton);
+ emiteUIProvider.get().onChatAttended(new Listener<String>() {
+ public void onEvent(final String parameter) {
+ traybarButton.setIcon("images/e-icon.gif");
+ }
+ });
+ emiteUIProvider.get().onChatUnattendedWithActivity(new Listener<String>() {
+ public void onEvent(final String parameter) {
+ traybarButton.setIcon("images/e-icon-a.gif");
+ }
+ });
+ }
+ emiteUIProvider.get().hide();
+ emiteUIProvider.get().onChatAttended(new Listener<String>() {
+ public void onEvent(final String parameter) {
+ Window.setTitle(initialWindowTitle);
+ }
+ });
+ emiteUIProvider.get().onChatUnattendedWithActivity(new Listener<String>() {
+ public void onEvent(final String chatTitle) {
+ Window.setTitle("(* " + chatTitle + ") " + initialWindowTitle);
+ }
+ });
+ }
+
+ public void logout() {
+ if (!emiteUIProvider.get().isDialogNotStarted()) {
+ emiteUIProvider.get().setOwnPresence(OwnStatus.offline);
+ chatOptions.userOptions = getUserChatOptions("reset(a)example.com", "");
+ emiteUIProvider.get().refreshUserInfo(chatOptions.userOptions);
+ emiteUIProvider.get().setEnableStatusUI(false);
+ }
+ }
+
+ public void show() {
+ emiteUIProvider.get().show();
+ }
+
+ public void stop() {
+ if (!emiteUIProvider.get().isDialogNotStarted()) {
+ emiteUIProvider.get().destroy();
+ }
+ if (emiteUIProvider.get().getSession().isLoggedIn()) {
+ emiteUIProvider.get().getSession().logout();
+ }
+ }
+
+ private UserChatOptions getUserChatOptions(final String jid, final String passwd) {
+ final String resource = "emiteui-" + new Date().getTime() + "-kune"; // +
+ // getGwtMetaProperty(GWT_PROPERTY_RELEASE);
+ // FIXME, get this from user profile
+ return new UserChatOptions(jid + "@" + chatOptions.domain, passwd, resource, "blue",
+ SubscriptionMode.autoAcceptAll, true);
+ }
+}
Property changes on: trunk/src/main/java/org/ourproject/kune/chat/client/ChatEngineDefault.java
___________________________________________________________________
Name: svn:mergeinfo
+
Deleted: trunk/src/main/java/org/ourproject/kune/chat/client/ChatEngineXmpp.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/chat/client/ChatEngineXmpp.java 2008-11-04 15:07:14 UTC (rev 939)
+++ trunk/src/main/java/org/ourproject/kune/chat/client/ChatEngineXmpp.java 2008-11-05 22:07:07 UTC (rev 940)
@@ -1,161 +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 java.util.Date;
-
-import org.ourproject.kune.platf.client.services.I18nTranslationService;
-import org.ourproject.kune.workspace.client.site.Site;
-import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton;
-
-import com.calclab.emite.core.client.xmpp.stanzas.XmppURI;
-import com.calclab.emiteuimodule.client.EmiteUIDialog;
-import com.calclab.emiteuimodule.client.SubscriptionMode;
-import com.calclab.emiteuimodule.client.UserChatOptions;
-import com.calclab.emiteuimodule.client.params.AvatarProvider;
-import com.calclab.emiteuimodule.client.status.OwnPresence.OwnStatus;
-import com.calclab.suco.client.listener.Listener;
-import com.google.gwt.user.client.Window;
-import com.gwtext.client.core.EventObject;
-import com.gwtext.client.widgets.Button;
-import com.gwtext.client.widgets.ToolbarButton;
-import com.gwtext.client.widgets.event.ButtonListenerAdapter;
-
-class ChatEngineXmpp implements ChatEngine {
- private final ChatConnectionOptions chatOptions;
- private final EmiteUIDialog emiteDialog;
- private final I18nTranslationService i18n;
- private final WorkspaceSkeleton ws;
- private ToolbarButton traybarButton;
-
- public ChatEngineXmpp(final EmiteUIDialog emiteUIDialog, final ChatConnectionOptions chatOptions,
- final I18nTranslationService i18n, final WorkspaceSkeleton ws) {
- this.emiteDialog = emiteUIDialog;
- this.chatOptions = chatOptions;
- this.i18n = i18n;
- this.ws = ws;
- }
-
- public void addNewBuddie(String shortName) {
- Site.important("In development (emite)");
- }
-
- public ChatConnectionOptions getChatOptions() {
- return chatOptions;
- }
-
- public void joinRoom(final String roomName, final String userAlias) {
- if (emiteDialog.isLoggedIn()) {
- final XmppURI roomURI = XmppURI.uri(roomName + "@" + chatOptions.roomHost + "/"
- + chatOptions.userOptions.getUserJid().getNode());
- emiteDialog.joinRoom(roomURI);
- } else {
- ws.showAlertMessage(i18n.t("Error"), i18n.t("To join a chatroom you need to be 'online'."));
- }
- }
-
- public void login(final String jid, final String passwd) {
- final UserChatOptions userChatOptions = getUserChatOptions(jid, passwd);
- // FIXME: Avatar provider
- final AvatarProvider avatarProvider = new AvatarProvider() {
- public String getAvatarURL(XmppURI userURI) {
- return "images/person-def.gif";
- }
- };
- final String initialWindowTitle = Window.getTitle();
- chatOptions.userOptions = userChatOptions;
- if (emiteDialog.isDialogNotStarted()) {
- emiteDialog.start(userChatOptions, chatOptions.httpBase, chatOptions.roomHost, initialWindowTitle,
- avatarProvider, i18n.t("Chat"));
- } else {
- emiteDialog.setEnableStatusUI(true);
- emiteDialog.refreshUserInfo(chatOptions.userOptions);
- }
- emiteDialog.show(OwnStatus.online);
- if (traybarButton == null) {
- traybarButton = new ToolbarButton();
- traybarButton.setTooltip(i18n.t("Show/hide the chat window"));
- // traybarButton.setIcon("images/emite-chat.gif");
- traybarButton.setIcon("images/e-icon.gif");
- traybarButton.addListener(new ButtonListenerAdapter() {
- @Override
- public void onClick(final Button button, final EventObject e) {
- if (emiteDialog.isVisible()) {
- emiteDialog.hide();
- } else {
- emiteDialog.show();
- }
- }
- });
- ws.getSiteTraybar().addButton(traybarButton);
- emiteDialog.onChatAttended(new Listener<String>() {
- public void onEvent(final String parameter) {
- traybarButton.setIcon("images/e-icon.gif");
- }
- });
- emiteDialog.onChatUnattendedWithActivity(new Listener<String>() {
- public void onEvent(final String parameter) {
- traybarButton.setIcon("images/e-icon-a.gif");
- }
- });
- }
- emiteDialog.hide();
- emiteDialog.onChatAttended(new Listener<String>() {
- public void onEvent(final String parameter) {
- Window.setTitle(initialWindowTitle);
- }
- });
- emiteDialog.onChatUnattendedWithActivity(new Listener<String>() {
- public void onEvent(final String chatTitle) {
- Window.setTitle("(* " + chatTitle + ") " + initialWindowTitle);
- }
- });
- }
-
- public void logout() {
- if (!emiteDialog.isDialogNotStarted()) {
- emiteDialog.setOwnPresence(OwnStatus.offline);
- chatOptions.userOptions = getUserChatOptions("reset(a)example.com", "");
- emiteDialog.refreshUserInfo(chatOptions.userOptions);
- emiteDialog.setEnableStatusUI(false);
- }
- }
-
- public void show() {
- emiteDialog.show();
- }
-
- public void stop() {
- if (!emiteDialog.isDialogNotStarted()) {
- emiteDialog.destroy();
- }
- if (emiteDialog.getSession().isLoggedIn()) {
- emiteDialog.getSession().logout();
- }
- }
-
- private UserChatOptions getUserChatOptions(final String jid, final String passwd) {
- final String resource = "emiteui-" + new Date().getTime() + "-kune"; // +
- // getGwtMetaProperty(GWT_PROPERTY_RELEASE);
- // FIXME, get this from user profile
- return new UserChatOptions(jid + "@" + chatOptions.domain, passwd, resource, "blue",
- SubscriptionMode.autoAcceptAll, true);
- }
-}
Deleted: trunk/src/main/java/org/ourproject/kune/chat/client/cnt/RoomViewListener.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/chat/client/cnt/RoomViewListener.java 2008-11-04 15:07:14 UTC (rev 939)
+++ trunk/src/main/java/org/ourproject/kune/chat/client/cnt/RoomViewListener.java 2008-11-05 22:07:07 UTC (rev 940)
@@ -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.chat.client.cnt;
-
-public interface RoomViewListener {
-
- void onEnterRoom();
-
-}
Deleted: trunk/src/main/java/org/ourproject/kune/chat/client/cnt/RoomViewPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/chat/client/cnt/RoomViewPanel.java 2008-11-04 15:07:14 UTC (rev 939)
+++ trunk/src/main/java/org/ourproject/kune/chat/client/cnt/RoomViewPanel.java 2008-11-05 22:07:07 UTC (rev 940)
@@ -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.chat.client.cnt;
-
-import org.ourproject.kune.platf.client.View;
-
-import com.google.gwt.user.client.ui.Button;
-import com.google.gwt.user.client.ui.ClickListener;
-import com.google.gwt.user.client.ui.FlowPanel;
-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 RoomViewPanel extends VerticalPanel implements View {
-
- public RoomViewPanel(final RoomViewListener listener) {
- FlowPanel flow = new FlowPanel();
- Button btnEnter = new Button("entrar", new ClickListener() {
- public void onClick(Widget arg0) {
- listener.onEnterRoom();
- }
- });
- flow.add(btnEnter);
- Label label = new Label("panel del chat: contenido por defecto");
-
- add(flow);
- add(label);
- }
-}
Deleted: 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-11-04 15:07:14 UTC (rev 939)
+++ trunk/src/main/java/org/ourproject/kune/chat/client/cnt/room/ChatRoomControl.java 2008-11-05 22:07:07 UTC (rev 940)
@@ -1,24 +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.room;
-
-public interface ChatRoomControl {
-
-}
Deleted: trunk/src/main/java/org/ourproject/kune/chat/client/cnt/room/ChatRoomControlPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/chat/client/cnt/room/ChatRoomControlPanel.java 2008-11-04 15:07:14 UTC (rev 939)
+++ trunk/src/main/java/org/ourproject/kune/chat/client/cnt/room/ChatRoomControlPanel.java 2008-11-05 22:07:07 UTC (rev 940)
@@ -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.chat.client.cnt.room;
-
-import org.ourproject.kune.platf.client.services.I18nTranslationService;
-import org.ourproject.kune.platf.client.ui.CustomPushButton;
-
-import com.google.gwt.user.client.ui.ClickListener;
-import com.google.gwt.user.client.ui.HorizontalPanel;
-import com.google.gwt.user.client.ui.Widget;
-
-public class ChatRoomControlPanel extends HorizontalPanel implements ChatRoomControlView {
- private final CustomPushButton enterRoomBtn;
-
- public ChatRoomControlPanel(final I18nTranslationService i18n, final ChatRoomControlPresenter presenter) {
- enterRoomBtn = new CustomPushButton(i18n.t("Enter room"), new ClickListener() {
- public void onClick(final Widget sender) {
- presenter.onEnterRoom();
- }
- });
- add(enterRoomBtn);
- setEnterRoomEnabled(true);
- }
-
- public void setEnterRoomEnabled(final boolean isEnabled) {
- enterRoomBtn.setEnabled(isEnabled);
- }
-
-}
\ No newline at end of file
Deleted: trunk/src/main/java/org/ourproject/kune/chat/client/cnt/room/ChatRoomControlPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/chat/client/cnt/room/ChatRoomControlPresenter.java 2008-11-04 15:07:14 UTC (rev 939)
+++ trunk/src/main/java/org/ourproject/kune/chat/client/cnt/room/ChatRoomControlPresenter.java 2008-11-05 22:07:07 UTC (rev 940)
@@ -1,41 +0,0 @@
-/*
- *
- * Copyright (C) 2007-2008 The kune development team (see CREDITS for details)
- * This file is part of kune.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-package org.ourproject.kune.chat.client.cnt.room;
-
-import org.ourproject.kune.platf.client.View;
-
-public class ChatRoomControlPresenter implements ChatRoomControl {
-
- private ChatRoomControlView view;
-
- public View getView() {
- return view;
- }
-
- public void init(final ChatRoomControlView view) {
- this.view = view;
- }
-
- public void onEnterRoom() {
- // TODO Auto-generated method stub
-
- }
-
-}
Deleted: trunk/src/main/java/org/ourproject/kune/chat/client/cnt/room/ChatRoomControlView.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/chat/client/cnt/room/ChatRoomControlView.java 2008-11-04 15:07:14 UTC (rev 939)
+++ trunk/src/main/java/org/ourproject/kune/chat/client/cnt/room/ChatRoomControlView.java 2008-11-05 22:07:07 UTC (rev 940)
@@ -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.chat.client.cnt.room;
-
-import org.ourproject.kune.platf.client.View;
-
-public interface ChatRoomControlView extends View {
-
-}
Modified: trunk/src/main/java/org/ourproject/kune/chat/client/ctx/ChatContextPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/chat/client/ctx/ChatContextPresenter.java 2008-11-04 15:07:14 UTC (rev 939)
+++ trunk/src/main/java/org/ourproject/kune/chat/client/ctx/ChatContextPresenter.java 2008-11-05 22:07:07 UTC (rev 940)
@@ -19,21 +19,21 @@
*/
package org.ourproject.kune.chat.client.ctx;
-import org.ourproject.kune.chat.client.ctx.rooms.RoomsAdmin;
+import org.ourproject.kune.chat.client.ctx.room.RoomAdmin;
import org.ourproject.kune.platf.client.dto.StateContainerDTO;
import com.calclab.suco.client.ioc.Provider;
public class ChatContextPresenter implements ChatContext {
- private final Provider<RoomsAdmin> roomAdminsProvider;
+ private final Provider<RoomAdmin> roomAdminsProvider;
- public ChatContextPresenter(final Provider<RoomsAdmin> roomAdminsProvider) {
+ public ChatContextPresenter(final Provider<RoomAdmin> roomAdminsProvider) {
this.roomAdminsProvider = roomAdminsProvider;
}
public void setState(final StateContainerDTO state) {
- final RoomsAdmin rooms = roomAdminsProvider.get();
+ final RoomAdmin rooms = roomAdminsProvider.get();
rooms.showRoom(state.getStateToken(), state.getContainer(), state.getContainerRights());
}
}
Copied: trunk/src/main/java/org/ourproject/kune/chat/client/ctx/room (from rev 934, trunk/src/main/java/org/ourproject/kune/chat/client/ctx/rooms)
Property changes on: trunk/src/main/java/org/ourproject/kune/chat/client/ctx/room
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: trunk/src/main/java/org/ourproject/kune/chat/client/ctx/room/RoomAdmin.java (from rev 934, trunk/src/main/java/org/ourproject/kune/chat/client/ctx/rooms/RoomsAdmin.java)
===================================================================
--- trunk/src/main/java/org/ourproject/kune/chat/client/ctx/rooms/RoomsAdmin.java 2008-10-28 15:40:27 UTC (rev 934)
+++ trunk/src/main/java/org/ourproject/kune/chat/client/ctx/room/RoomAdmin.java 2008-11-05 22:07:07 UTC (rev 940)
@@ -0,0 +1,28 @@
+/*
+ *
+ * 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.ctx.room;
+
+import org.ourproject.kune.platf.client.dto.AccessRightsDTO;
+import org.ourproject.kune.platf.client.dto.ContainerDTO;
+import org.ourproject.kune.platf.client.dto.StateToken;
+
+public interface RoomAdmin {
+ void showRoom(final StateToken token, final ContainerDTO container, final AccessRightsDTO rights);
+}
Property changes on: trunk/src/main/java/org/ourproject/kune/chat/client/ctx/room/RoomAdmin.java
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: trunk/src/main/java/org/ourproject/kune/chat/client/ctx/room/RoomAdminPresenter.java (from rev 934, 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-10-28 15:40:27 UTC (rev 934)
+++ trunk/src/main/java/org/ourproject/kune/chat/client/ctx/room/RoomAdminPresenter.java 2008-11-05 22:07:07 UTC (rev 940)
@@ -0,0 +1,77 @@
+/*
+ *
+ * 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.ctx.room;
+
+import org.ourproject.kune.platf.client.dto.AccessRightsDTO;
+import org.ourproject.kune.platf.client.dto.ContainerDTO;
+import org.ourproject.kune.platf.client.dto.StateToken;
+import org.ourproject.kune.platf.client.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.ctxnav.ContextNavigator;
+
+import com.calclab.suco.client.ioc.Provider;
+
+public class RoomAdminPresenter implements RoomAdmin {
+ private final ContextNavigator contextNavigator;
+
+ public RoomAdminPresenter(final ContextNavigator contextNavigator, final I18nTranslationService i18n,
+ final Provider<StateManager> stateManagerProvider, final Session session,
+ final Provider<ContentServiceAsync> contentServiceProvider) {
+ this.contextNavigator = contextNavigator;
+ // final ContextNavigatorImages images =
+ // ContextNavigatorImages.App.getInstance();
+ // contextNavigator.registerType(ChatClientTool.TYPE_CHAT,
+ // images.page());
+ // contextNavigator.registerType(ChatClientTool.TYPE_ROOM,
+ // images.chatGreen());
+ // contextNavigator.canCreate(i18n.t("New chat room"), i18n.t("Add a
+ // chat room"), new Listener<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 void showRoom(final StateToken token, final ContainerDTO container, final AccessRightsDTO rights) {
+ // contextNavigator.showContainer(token, container, rights);
+ // final String type = container.getTypeId();
+ // if (type.equals(ChatClientTool.TYPE_ROOM)) {
+ // contextNavigator.setControlsVisible(false);
+ // }
+ }
+
+}
Property changes on: trunk/src/main/java/org/ourproject/kune/chat/client/ctx/room/RoomAdminPresenter.java
___________________________________________________________________
Name: svn:mergeinfo
+
Deleted: trunk/src/main/java/org/ourproject/kune/chat/client/ctx/room/RoomsAdmin.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/chat/client/ctx/rooms/RoomsAdmin.java 2008-10-28 15:40:27 UTC (rev 934)
+++ trunk/src/main/java/org/ourproject/kune/chat/client/ctx/room/RoomsAdmin.java 2008-11-05 22:07:07 UTC (rev 940)
@@ -1,31 +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.ctx.rooms;
-
-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.StateToken;
-
-public interface RoomsAdmin {
- View getView();
-
- void showRoom(final StateToken token, final ContainerDTO container, final AccessRightsDTO rights);
-}
Deleted: trunk/src/main/java/org/ourproject/kune/chat/client/ctx/room/RoomsAdminPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/chat/client/ctx/rooms/RoomsAdminPresenter.java 2008-10-28 15:40:27 UTC (rev 934)
+++ trunk/src/main/java/org/ourproject/kune/chat/client/ctx/room/RoomsAdminPresenter.java 2008-11-05 22:07:07 UTC (rev 940)
@@ -1,82 +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.ctx.rooms;
-
-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.StateToken;
-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.ctxnav.ContextNavigator;
-
-import com.calclab.suco.client.ioc.Provider;
-
-public class RoomsAdminPresenter implements RoomsAdmin {
- private final ContextNavigator contextNavigator;
-
- public RoomsAdminPresenter(final ContextNavigator contextNavigator, final I18nTranslationService i18n,
- final Provider<StateManager> stateManagerProvider, final Session session,
- final Provider<ContentServiceAsync> contentServiceProvider) {
- this.contextNavigator = contextNavigator;
- // final ContextNavigatorImages images =
- // ContextNavigatorImages.App.getInstance();
- // contextNavigator.registerType(ChatClientTool.TYPE_CHAT,
- // images.page());
- // contextNavigator.registerType(ChatClientTool.TYPE_ROOM,
- // images.chatGreen());
- // contextNavigator.canCreate(i18n.t("New chat room"), i18n.t("Add a
- // chat room"), new Listener<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 contextNavigator.getView();
- }
-
- public void showRoom(final StateToken token, final ContainerDTO container, final AccessRightsDTO rights) {
- // contextNavigator.showContainer(token, container, rights);
- // final String type = container.getTypeId();
- // if (type.equals(ChatClientTool.TYPE_ROOM)) {
- // contextNavigator.setControlsVisible(false);
- // }
- }
-
-}
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-04 15:07:14 UTC (rev 939)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientModule.java 2008-11-05 22:07:07 UTC (rev 940)
@@ -25,10 +25,10 @@
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.reader.DocumentViewer;
-import org.ourproject.kune.docs.client.cnt.reader.DocumentViewerPanel;
-import org.ourproject.kune.docs.client.cnt.reader.DocumentViewerPresenter;
-import org.ourproject.kune.docs.client.cnt.reader.DocumentViewerView;
+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;
+import org.ourproject.kune.docs.client.cnt.viewer.DocumentViewerView;
import org.ourproject.kune.docs.client.ctx.DocumentContext;
import org.ourproject.kune.docs.client.ctx.DocumentContextPresenter;
import org.ourproject.kune.docs.client.ctx.admin.DocContextEditor;
Modified: trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientTool.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientTool.java 2008-11-04 15:07:14 UTC (rev 939)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientTool.java 2008-11-05 22:07:07 UTC (rev 940)
@@ -22,14 +22,13 @@
import org.ourproject.kune.platf.client.actions.ContentIconsRegistry;
import org.ourproject.kune.platf.client.actions.DragDropContentRegistry;
import org.ourproject.kune.platf.client.dto.BasicMimeTypeDTO;
-import org.ourproject.kune.platf.client.tool.AbstractClientTool;
+import org.ourproject.kune.platf.client.tool.FoldableAbstractClientTool;
import org.ourproject.kune.platf.client.tool.ToolSelector;
import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService;
import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton;
import org.ourproject.kune.workspace.client.themes.WsThemePresenter;
-
-public class DocumentClientTool extends AbstractClientTool {
+public class DocumentClientTool extends FoldableAbstractClientTool {
public static final String TYPE_ROOT = "docs.root";
public static final String TYPE_FOLDER = "docs.folder";
public static final String TYPE_DOCUMENT = "docs.doc";
@@ -39,28 +38,21 @@
public static final String TYPE_WIKI = "docs.wiki";
public static final String TYPE_WIKIPAGE = "docs.wikipage";
public static final String TYPE_UPLOADEDFILE = "docs.uploaded";
-
public static final String NAME = "docs";
- private final DragDropContentRegistry dragDropContentRegistry;
- private final ContentIconsRegistry contentIconsRegistry;
-
public DocumentClientTool(final I18nUITranslationService i18n, final ToolSelector toolSelector,
final WsThemePresenter wsThemePresenter, final WorkspaceSkeleton ws,
- final DragDropContentRegistry dragDropContentRegistry,
- final ContentIconsRegistry contentIconsRegistry) {
- super(NAME, i18n.t("documents"), toolSelector, wsThemePresenter, ws);
- this.dragDropContentRegistry = dragDropContentRegistry;
- this.contentIconsRegistry = contentIconsRegistry;
- registerDragDropTypes();
- registerIcons();
+ final DragDropContentRegistry dragDropContentRegistry, final ContentIconsRegistry contentIconsRegistry) {
+ super(NAME, i18n.t("documents"), toolSelector, wsThemePresenter, ws, contentIconsRegistry,
+ dragDropContentRegistry);
}
public String getName() {
return NAME;
}
- private void registerDragDropTypes() {
+ @Override
+ protected void registerDragDropTypes() {
dragDropContentRegistry.registerDraggableType(TYPE_DOCUMENT);
dragDropContentRegistry.registerDraggableType(TYPE_FOLDER);
dragDropContentRegistry.registerDraggableType(TYPE_UPLOADEDFILE);
@@ -70,7 +62,8 @@
dragDropContentRegistry.registerDroppableType(TYPE_GALLERY);
}
- private void registerIcons() {
+ @Override
+ protected void registerIcons() {
contentIconsRegistry.registerContentTypeIcon(TYPE_FOLDER, "images/nav/folder.png");
contentIconsRegistry.registerContentTypeIcon(TYPE_BLOG, "images/nav/blog.png");
contentIconsRegistry.registerContentTypeIcon(TYPE_GALLERY, "images/nav/gallery.png");
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-04 15:07:14 UTC (rev 939)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/cnt/DocumentContentPresenter.java 2008-11-05 22:07:07 UTC (rev 940)
@@ -21,7 +21,7 @@
import org.ourproject.kune.docs.client.DocumentClientTool;
import org.ourproject.kune.docs.client.cnt.folder.viewer.FolderViewer;
-import org.ourproject.kune.docs.client.cnt.reader.DocumentViewer;
+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;
import org.ourproject.kune.platf.client.actions.toolbar.ActionToolbar;
Copied: trunk/src/main/java/org/ourproject/kune/docs/client/cnt/viewer (from rev 934, trunk/src/main/java/org/ourproject/kune/docs/client/cnt/reader)
Property changes on: trunk/src/main/java/org/ourproject/kune/docs/client/cnt/viewer
___________________________________________________________________
Name: svn:mergeinfo
+
Deleted: trunk/src/main/java/org/ourproject/kune/docs/client/cnt/viewer/DocumentReader.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/cnt/reader/DocumentReader.java 2008-10-28 15:40:27 UTC (rev 934)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/cnt/viewer/DocumentReader.java 2008-11-05 22:07:07 UTC (rev 940)
@@ -1,31 +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.reader;
-
-import org.ourproject.kune.platf.client.View;
-import org.ourproject.kune.platf.client.dto.BasicMimeTypeDTO;
-import org.ourproject.kune.platf.client.dto.StateToken;
-
-public interface DocumentReader {
-
- View getView();
-
- void showDocument(StateToken token, String text, String typeId, BasicMimeTypeDTO mimeType);
-}
Deleted: trunk/src/main/java/org/ourproject/kune/docs/client/cnt/viewer/DocumentReaderPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/cnt/reader/DocumentReaderPresenter.java 2008-10-28 15:40:27 UTC (rev 934)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/cnt/viewer/DocumentReaderPresenter.java 2008-11-05 22:07:07 UTC (rev 940)
@@ -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.docs.client.cnt.reader;
-
-import org.ourproject.kune.docs.client.DocumentClientTool;
-import org.ourproject.kune.platf.client.View;
-import org.ourproject.kune.platf.client.dto.BasicMimeTypeDTO;
-import org.ourproject.kune.platf.client.dto.StateToken;
-import org.ourproject.kune.platf.client.ui.download.FileDownloadUtils;
-import org.ourproject.kune.platf.client.ui.download.ImageSize;
-
-import com.calclab.suco.client.ioc.Provider;
-
-public class DocumentReaderPresenter implements DocumentReader {
- private final DocumentReaderView view;
- private final Provider<FileDownloadUtils> downloadProvider;
-
- public DocumentReaderPresenter(final DocumentReaderView view, final Provider<FileDownloadUtils> downloadProvider) {
- this.view = view;
- this.downloadProvider = downloadProvider;
- }
-
- public View getView() {
- return view;
- }
-
- public void showDocument(final StateToken token, final String text, final String typeId,
- final BasicMimeTypeDTO mimeType) {
- if (typeId.equals(DocumentClientTool.TYPE_UPLOADEDFILE)) {
- if (mimeType != null) {
- FileDownloadUtils fileDownloadUtils = downloadProvider.get();
- if (mimeType.getType().equals("image")) {
- view.showImage(fileDownloadUtils.getImageUrl(token), fileDownloadUtils.getImageResizedUrl(token,
- ImageSize.sized));
- } else if (mimeType.toString().equals("text/plain") || mimeType.toString().equals("application/pdf")) {
- view.setContent(text);
- } else {
- view.setContent("");
- }
- }
- } else {
- view.setContent(text);
- }
- }
-}
Deleted: trunk/src/main/java/org/ourproject/kune/docs/client/cnt/viewer/DocumentReaderView.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/cnt/reader/DocumentReaderView.java 2008-10-28 15:40:27 UTC (rev 934)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/cnt/viewer/DocumentReaderView.java 2008-11-05 22:07:07 UTC (rev 940)
@@ -1,30 +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.reader;
-
-import org.ourproject.kune.platf.client.View;
-
-public interface DocumentReaderView extends View {
-
- void setContent(String content);
-
- void showImage(String imageUrl, String imageResizedUrl);
-
-}
Copied: trunk/src/main/java/org/ourproject/kune/docs/client/cnt/viewer/DocumentViewer.java (from rev 939, trunk/src/main/java/org/ourproject/kune/docs/client/cnt/reader/DocumentViewer.java)
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/cnt/reader/DocumentViewer.java 2008-11-04 15:07:14 UTC (rev 939)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/cnt/viewer/DocumentViewer.java 2008-11-05 22:07:07 UTC (rev 940)
@@ -0,0 +1,31 @@
+/*
+ *
+ * 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.viewer;
+
+import org.ourproject.kune.platf.client.View;
+import org.ourproject.kune.platf.client.dto.BasicMimeTypeDTO;
+import org.ourproject.kune.platf.client.dto.StateToken;
+
+public interface DocumentViewer {
+
+ View getView();
+
+ void showDocument(StateToken token, String text, String typeId, BasicMimeTypeDTO mimeType);
+}
Copied: trunk/src/main/java/org/ourproject/kune/docs/client/cnt/viewer/DocumentViewerPanel.java (from rev 939, trunk/src/main/java/org/ourproject/kune/docs/client/cnt/reader/DocumentViewerPanel.java)
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/cnt/reader/DocumentViewerPanel.java 2008-11-04 15:07:14 UTC (rev 939)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/cnt/viewer/DocumentViewerPanel.java 2008-11-05 22:07:07 UTC (rev 940)
@@ -0,0 +1,73 @@
+/*
+ *
+ * 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.viewer;
+
+import org.ourproject.kune.platf.client.services.I18nTranslationService;
+import org.ourproject.kune.platf.client.ui.KuneUiUtils;
+import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton;
+
+import com.google.gwt.user.client.ui.ClickListener;
+import com.google.gwt.user.client.ui.HTML;
+import com.google.gwt.user.client.ui.Image;
+import com.google.gwt.user.client.ui.Widget;
+
+public class DocumentViewerPanel implements DocumentViewerView {
+
+ private final WorkspaceSkeleton ws;
+ private final I18nTranslationService i18n;
+
+ public DocumentViewerPanel(final WorkspaceSkeleton ws, I18nTranslationService i18n) {
+ this.ws = ws;
+ this.i18n = i18n;
+ }
+
+ public void setContent(final String content) {
+ final HTML html = new HTML(content);
+ setDefStyle(html);
+ ws.getEntityWorkspace().setContent(html);
+ }
+
+ public void showImage(String imageUrl, String imageResizedUrl) {
+ final Image imgOrig = new Image(imageUrl);
+ final Image imgResized = new Image(imageResizedUrl);
+ KuneUiUtils.setQuickTip(imgOrig, i18n.t("Click to zoom out"));
+ KuneUiUtils.setQuickTip(imgResized, i18n.t("Click to zoom in"));
+ setDefStyle(imgOrig);
+ setDefStyle(imgResized);
+ imgOrig.addStyleName("kune-pointer");
+ imgResized.addStyleName("kune-pointer");
+ imgResized.addClickListener(new ClickListener() {
+ public void onClick(Widget sender) {
+ ws.getEntityWorkspace().setContent(imgOrig);
+ }
+ });
+ imgOrig.addClickListener(new ClickListener() {
+ public void onClick(Widget sender) {
+ ws.getEntityWorkspace().setContent(imgResized);
+ }
+ });
+ ws.getEntityWorkspace().setContent(imgResized);
+ }
+
+ private void setDefStyle(final Widget widget) {
+ widget.setStyleName("kune-Content-Main");
+ widget.addStyleName("kune-Margin-7-trbl");
+ }
+}
Copied: trunk/src/main/java/org/ourproject/kune/docs/client/cnt/viewer/DocumentViewerPresenter.java (from rev 939, trunk/src/main/java/org/ourproject/kune/docs/client/cnt/reader/DocumentViewerPresenter.java)
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/cnt/reader/DocumentViewerPresenter.java 2008-11-04 15:07:14 UTC (rev 939)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/cnt/viewer/DocumentViewerPresenter.java 2008-11-05 22:07:07 UTC (rev 940)
@@ -0,0 +1,62 @@
+/*
+ *
+ * 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.viewer;
+
+import org.ourproject.kune.docs.client.DocumentClientTool;
+import org.ourproject.kune.platf.client.View;
+import org.ourproject.kune.platf.client.dto.BasicMimeTypeDTO;
+import org.ourproject.kune.platf.client.dto.StateToken;
+import org.ourproject.kune.platf.client.ui.download.FileDownloadUtils;
+import org.ourproject.kune.platf.client.ui.download.ImageSize;
+
+import com.calclab.suco.client.ioc.Provider;
+
+public class DocumentViewerPresenter implements DocumentViewer {
+ private final DocumentViewerView view;
+ private final Provider<FileDownloadUtils> downloadProvider;
+
+ public DocumentViewerPresenter(final DocumentViewerView view, final Provider<FileDownloadUtils> downloadProvider) {
+ this.view = view;
+ this.downloadProvider = downloadProvider;
+ }
+
+ public View getView() {
+ return view;
+ }
+
+ public void showDocument(final StateToken token, final String text, final String typeId,
+ final BasicMimeTypeDTO mimeType) {
+ if (typeId.equals(DocumentClientTool.TYPE_UPLOADEDFILE)) {
+ if (mimeType != null) {
+ FileDownloadUtils fileDownloadUtils = downloadProvider.get();
+ if (mimeType.getType().equals("image")) {
+ view.showImage(fileDownloadUtils.getImageUrl(token), fileDownloadUtils.getImageResizedUrl(token,
+ ImageSize.sized));
+ } else if (mimeType.toString().equals("text/plain") || mimeType.toString().equals("application/pdf")) {
+ view.setContent(text);
+ } else {
+ view.setContent("");
+ }
+ }
+ } else {
+ view.setContent(text);
+ }
+ }
+}
Copied: trunk/src/main/java/org/ourproject/kune/docs/client/cnt/viewer/DocumentViewerView.java (from rev 939, trunk/src/main/java/org/ourproject/kune/docs/client/cnt/reader/DocumentViewerView.java)
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/cnt/reader/DocumentViewerView.java 2008-11-04 15:07:14 UTC (rev 939)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/cnt/viewer/DocumentViewerView.java 2008-11-05 22:07:07 UTC (rev 940)
@@ -0,0 +1,30 @@
+/*
+ *
+ * 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.viewer;
+
+import org.ourproject.kune.platf.client.View;
+
+public interface DocumentViewerView extends View {
+
+ void setContent(String content);
+
+ void showImage(String imageUrl, String imageResizedUrl);
+
+}
Copied: trunk/src/main/java/org/ourproject/kune/platf/client/actions/BeforeActionCollection.java (from rev 939, trunk/src/main/java/org/ourproject/kune/platf/client/state/BeforeStateChangeCollection.java)
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/state/BeforeStateChangeCollection.java 2008-11-04 15:07:14 UTC (rev 939)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/BeforeActionCollection.java 2008-11-05 22:07:07 UTC (rev 940)
@@ -0,0 +1,18 @@
+package org.ourproject.kune.platf.client.actions;
+
+import java.util.ArrayList;
+
+public class BeforeActionCollection extends ArrayList<BeforeActionListener> {
+
+ private static final long serialVersionUID = 1L;
+
+ public boolean checkBeforeAction() {
+ for (BeforeActionListener listener : this) {
+ if (!listener.beforeAction()) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+}
Property changes on: trunk/src/main/java/org/ourproject/kune/platf/client/actions/BeforeActionCollection.java
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: trunk/src/main/java/org/ourproject/kune/platf/client/actions/BeforeActionListener.java (from rev 939, trunk/src/main/java/org/ourproject/kune/platf/client/state/BeforeActionListener.java)
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/state/BeforeActionListener.java 2008-11-04 15:07:14 UTC (rev 939)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/BeforeActionListener.java 2008-11-05 22:07:07 UTC (rev 940)
@@ -0,0 +1,7 @@
+package org.ourproject.kune.platf.client.actions;
+
+public interface BeforeActionListener {
+
+ boolean beforeAction();
+
+}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/services/ImageDescriptor.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/services/ImageDescriptor.java 2008-11-04 15:07:14 UTC (rev 939)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/services/ImageDescriptor.java 2008-11-05 22:07:07 UTC (rev 940)
@@ -19,5 +19,5 @@
*/package org.ourproject.kune.platf.client.services;
public enum ImageDescriptor {
- accept, add, addGreen, alert, anybody, arrowDownBlack, arrowDownGreen, arrowDownWhite, arrowLeftGreen, arrowRightBlack, arrowRightGreen, arrowRightWhite, arrowUpGreen, bulletAdd, bulletBlack, bulletBlue, bulletDelete, bulletGreen, bulletPink, bulletPurple, bulletRed, bulletStar, bulletToggleMinus, bulletTogglePlus, bulletYellow, button15cblue, button15cdark, button15clight, button15cxlight, button15lblue, button15ldark, button15llight, button15lxlight, button15rblue, button15rdark, button15rlight, button15rxlight, button17cblue, button17cdark, button17clight, button17cxlight, button17lblue, button17ldark, button17llight, button17lxlight, button17rblue, button17rdark, button17rlight, button17rxlight, button20cblue, button20cdark, button20clight, button20cxlight, button20lblue, button20ldark, button20llight, button20lxlight, button20rblue, button20rdark, button20rlight, button20rxlight, buttonArrowDown, buttonHelpBlue, buttonHelpDark, buttonHelpLight, buttonSitebarArrowDown, by80x15, bync80x15, byncnd80x15, byncsa80x15, bynd80x15, bysa80x15, cancel, chat, clear, copyleft, cross, crossDark, del, emblemImportant, error, everybody, fullscreen, gnuFdl, groupDefIcon, groupHome, important, info, infoLight, kuneClose, kuneExternalWindow, kuneHelpTranslationIcon, kuneIcon16, kuneLogo16px, kunePreferences, kuneSearchIco, kuneSearchIcoPush, language, nobody, noCopyleft, nt, opentriangle, personDef, remove, rssIcon, searchIco, spinKuneThundGreen, splitterVertBar, star10, star20, star30, star40, star50, star60, star70, star80, star90, starGrey, starSmallYellow, starVsmallYellow, starYellow, step1, step2, step3, step4, step5, themeChoose, triangle
+ accept, add, addGreen, alert, anybody, arrowDownBlack, arrowDownGreen, arrowDownWhite, arrowLeftGreen, arrowRightBlack, arrowRightGreen, arrowRightWhite, arrowUpGreen, bulletAdd, bulletBlack, bulletBlue, bulletDelete, bulletGreen, bulletPink, bulletPurple, bulletRed, bulletStar, bulletToggleMinus, bulletTogglePlus, bulletYellow, button15cblue, button15cdark, button15clight, button15cxlight, button15lblue, button15ldark, button15llight, button15lxlight, button15rblue, button15rdark, button15rlight, button15rxlight, button17cblue, button17cdark, button17clight, button17cxlight, button17lblue, button17ldark, button17llight, button17lxlight, button17rblue, button17rdark, button17rlight, button17rxlight, button20cblue, button20cdark, button20clight, button20cxlight, button20lblue, button20ldark, button20llight, button20lxlight, button20rblue, button20rdark, button20rlight, button20rxlight, buttonArrowDown, buttonHelpBlue, buttonHelpDark, buttonHelpLight, buttonSitebarArrowDown, by80x15, bync80x15, byncnd80x15, byncsa80x15, bynd80x15, bysa80x15, cancel, clear, copyleft, cross, crossDark, del, emblemImportant, error, everybody, fullscreen, gnuFdl, groupDefIcon, groupHome, important, info, infoLight, kuneClose, kuneExternalWindow, kuneHelpTranslationIcon, kuneIcon16, kuneLogo16px, kunePreferences, kuneSearchIco, kuneSearchIcoPush, language, nobody, noCopyleft, nt, opentriangle, personDef, remove, rssIcon, searchIco, spinKuneThundGreen, splitterVertBar, star10, star20, star30, star40, star50, star60, star70, star80, star90, starGrey, starSmallYellow, starVsmallYellow, starYellow, step1, step2, step3, step4, step5, themeChoose, triangle
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/services/ImageUtils.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/services/ImageUtils.java 2008-11-04 15:07:14 UTC (rev 939)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/services/ImageUtils.java 2008-11-05 22:07:07 UTC (rev 940)
@@ -249,9 +249,6 @@
case cancel: {
return img.cancel();
}
- case chat: {
- return img.chat();
- }
case clear: {
return img.clear();
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/services/Images.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/services/Images.java 2008-11-04 15:07:14 UTC (rev 939)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/services/Images.java 2008-11-05 22:07:07 UTC (rev 940)
@@ -255,9 +255,6 @@
@Resource("org/ourproject/kune/platf/public/images/cancel.png")
AbstractImagePrototype cancel();
- @Resource("org/ourproject/kune/platf/public/images/chat.png")
- AbstractImagePrototype chat();
-
@Resource("org/ourproject/kune/platf/public/images/clear.png")
AbstractImagePrototype clear();
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-04 15:07:14 UTC (rev 939)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneModule.java 2008-11-05 22:07:07 UTC (rev 940)
@@ -102,6 +102,7 @@
import org.ourproject.kune.workspace.client.site.SiteToken;
import org.ourproject.kune.workspace.client.site.rpc.UserService;
import org.ourproject.kune.workspace.client.site.rpc.UserServiceAsync;
+import org.ourproject.kune.workspace.client.sitebar.sitesign.SiteSignOutLink;
import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton;
import org.ourproject.kune.workspace.client.themes.WsThemePresenter;
import org.ourproject.kune.workspace.client.title.EntityTitle;
@@ -348,7 +349,7 @@
contentNavigatorToolbar);
final TextEditorPresenter presenter = new TextEditorPresenter(true, toolbar,
- $(I18nUITranslationService.class), $(StateManager.class));
+ $(I18nUITranslationService.class), $(StateManager.class), $(SiteSignOutLink.class));
final TextEditorPanel panel = new TextEditorPanel(presenter, $(I18nTranslationService.class),
$(WorkspaceSkeleton.class), $(ColorWebSafePalette.class));
presenter.init(panel);
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneWorkspaceModule.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneWorkspaceModule.java 2008-11-04 15:07:14 UTC (rev 939)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneWorkspaceModule.java 2008-11-05 22:07:07 UTC (rev 940)
@@ -18,7 +18,7 @@
*
*/package org.ourproject.kune.platf.client.services;
-import org.ourproject.kune.chat.client.ChatClientTool;
+import org.ourproject.kune.chat.client.ChatEngine;
import org.ourproject.kune.platf.client.actions.ActionManager;
import org.ourproject.kune.platf.client.actions.ContentIconsRegistry;
import org.ourproject.kune.platf.client.actions.UserActionRegistry;
@@ -334,7 +334,7 @@
final GroupMembersSummaryPresenter presenter = new GroupMembersSummaryPresenter(
$(I18nUITranslationService.class), $(StateManager.class), $(ImageUtils.class),
$(Session.class), $$(SocialNetworkServiceAsync.class), $$(GroupLiveSearcher.class),
- $(WsThemePresenter.class));
+ $(WsThemePresenter.class), $$(ChatEngine.class));
final GroupMembersSummaryView view = new GroupMembersSummaryPanel(presenter,
$(I18nUITranslationService.class), $(WorkspaceSkeleton.class));
presenter.init(view);
@@ -359,7 +359,7 @@
public BuddiesSummary create() {
final BuddiesSummaryPresenter presenter = new BuddiesSummaryPresenter($(StateManager.class),
$(Session.class), $(UserActionRegistry.class), $(I18nTranslationService.class),
- $$(ChatClientTool.class));
+ $$(ChatEngine.class));
final BuddiesSummaryPanel panel = new BuddiesSummaryPanel(presenter, $(WorkspaceSkeleton.class),
$(I18nTranslationService.class), $(ActionManager.class));
presenter.init(panel);
Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/state/BeforeActionListener.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/state/BeforeActionListener.java 2008-11-04 15:07:14 UTC (rev 939)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/state/BeforeActionListener.java 2008-11-05 22:07:07 UTC (rev 940)
@@ -1,7 +0,0 @@
-package org.ourproject.kune.platf.client.state;
-
-public interface BeforeActionListener {
-
- boolean beforeAction();
-
-}
Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/state/BeforeStateChangeCollection.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/state/BeforeStateChangeCollection.java 2008-11-04 15:07:14 UTC (rev 939)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/state/BeforeStateChangeCollection.java 2008-11-05 22:07:07 UTC (rev 940)
@@ -1,9 +0,0 @@
-package org.ourproject.kune.platf.client.state;
-
-import java.util.ArrayList;
-
-public class BeforeStateChangeCollection extends ArrayList<BeforeActionListener> {
-
- private static final long serialVersionUID = 1L;
-
-}
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-11-04 15:07:14 UTC (rev 939)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/state/StateManager.java 2008-11-05 22:07:07 UTC (rev 940)
@@ -19,6 +19,7 @@
*/
package org.ourproject.kune.platf.client.state;
+import org.ourproject.kune.platf.client.actions.BeforeActionListener;
import org.ourproject.kune.platf.client.dto.SocialNetworkResultDTO;
import org.ourproject.kune.platf.client.dto.StateAbstractDTO;
import org.ourproject.kune.platf.client.dto.StateToken;
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-04 15:07:14 UTC (rev 939)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/state/StateManagerDefault.java 2008-11-05 22:07:07 UTC (rev 940)
@@ -21,6 +21,8 @@
import java.util.HashMap;
+import org.ourproject.kune.platf.client.actions.BeforeActionCollection;
+import org.ourproject.kune.platf.client.actions.BeforeActionListener;
import org.ourproject.kune.platf.client.app.HistoryWrapper;
import org.ourproject.kune.platf.client.dto.ParticipationDataDTO;
import org.ourproject.kune.platf.client.dto.SocialNetworkDTO;
@@ -55,7 +57,7 @@
private final Event<StateAbstractDTO> onSocialNetworkChanged;
private final Event2<String, String> onToolChanged;
private final Event2<String, String> onGroupChanged;
- private final BeforeStateChangeCollection beforeStateChangeCollection;
+ private final BeforeActionCollection beforeStateChangeCollection;
public StateManagerDefault(final ContentProvider contentProvider, final Session session,
final HistoryWrapper history) {
@@ -84,7 +86,7 @@
}
});
siteTokens = new HashMap<String, Listener0>();
- beforeStateChangeCollection = new BeforeStateChangeCollection();
+ beforeStateChangeCollection = new BeforeActionCollection();
}
public void addBeforeStateChangeListener(BeforeActionListener listener) {
@@ -109,7 +111,7 @@
}
public void onHistoryChanged(final String historyToken) {
- if (beforeStateListenersAllowChange()) {
+ if (beforeStateChangeCollection.checkBeforeAction()) {
final Listener0 tokenListener = siteTokens.get(historyToken);
Log.debug("StateManager: history token changed (" + historyToken + ")");
if (tokenListener == null) {
@@ -199,15 +201,6 @@
previousToken = newState.getStateToken();
}
- private boolean beforeStateListenersAllowChange() {
- for (BeforeActionListener listener : beforeStateChangeCollection) {
- if (!listener.beforeAction()) {
- return false;
- }
- }
- return true;
- }
-
private void checkGroupAndToolChange(final StateAbstractDTO newState) {
final String previousGroup = previousToken == null ? "" : previousToken.getGroup();
final String newGroup = newState.getStateToken().getGroup();
Added: trunk/src/main/java/org/ourproject/kune/platf/client/tool/FoldableAbstractClientTool.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/tool/FoldableAbstractClientTool.java 2008-11-04 15:07:14 UTC (rev 939)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/tool/FoldableAbstractClientTool.java 2008-11-05 22:07:07 UTC (rev 940)
@@ -0,0 +1,27 @@
+package org.ourproject.kune.platf.client.tool;
+
+import org.ourproject.kune.platf.client.actions.ContentIconsRegistry;
+import org.ourproject.kune.platf.client.actions.DragDropContentRegistry;
+import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton;
+import org.ourproject.kune.workspace.client.themes.WsThemePresenter;
+
+public abstract class FoldableAbstractClientTool extends AbstractClientTool {
+ protected final DragDropContentRegistry dragDropContentRegistry;
+ protected final ContentIconsRegistry contentIconsRegistry;
+
+ public FoldableAbstractClientTool(String shortName, String longName, ToolSelector toolSelector,
+ WsThemePresenter wsThemePresenter, WorkspaceSkeleton ws, final ContentIconsRegistry contentIconsRegistry,
+ final DragDropContentRegistry dragDropContentRegistry) {
+ super(shortName, longName, toolSelector, wsThemePresenter, ws);
+ this.dragDropContentRegistry = dragDropContentRegistry;
+ this.contentIconsRegistry = contentIconsRegistry;
+ registerDragDropTypes();
+ registerIcons();
+ }
+
+ protected void registerDragDropTypes() {
+ }
+
+ protected void registerIcons() {
+ }
+}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridMenuPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridMenuPanel.java 2008-11-04 15:07:14 UTC (rev 939)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridMenuPanel.java 2008-11-05 22:07:07 UTC (rev 940)
@@ -244,15 +244,13 @@
@Override
public void setHeight(final int height) {
super.setHeight(height);
- // grid.setHeight(height);
doLayoutIfNeeded();
}
@Override
public void setWidth(final int width) {
// grid.setWidth(width - 27);
- grid.setWidth(width - 27);
- // super.setWidth(width - 11);
+ super.setWidth(width);
doLayoutIfNeeded();
}
Deleted: trunk/src/main/java/org/ourproject/kune/platf/public/images/chat.png
===================================================================
(Binary files differ)
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/editor/TextEditorPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/editor/TextEditorPresenter.java 2008-11-04 15:07:14 UTC (rev 939)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/editor/TextEditorPresenter.java 2008-11-05 22:07:07 UTC (rev 940)
@@ -24,12 +24,13 @@
import org.ourproject.kune.platf.client.actions.ActionItemCollection;
import org.ourproject.kune.platf.client.actions.ActionToolbarButtonDescriptor;
import org.ourproject.kune.platf.client.actions.ActionToolbarPosition;
+import org.ourproject.kune.platf.client.actions.BeforeActionListener;
import org.ourproject.kune.platf.client.actions.toolbar.ActionToolbar;
import org.ourproject.kune.platf.client.dto.AccessRolDTO;
import org.ourproject.kune.platf.client.dto.StateToken;
-import org.ourproject.kune.platf.client.state.BeforeActionListener;
import org.ourproject.kune.platf.client.state.StateManager;
import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService;
+import org.ourproject.kune.workspace.client.sitebar.sitesign.SiteSignOutLink;
import com.calclab.suco.client.listener.Listener;
import com.calclab.suco.client.listener.Listener0;
@@ -52,13 +53,15 @@
private final I18nUITranslationService i18n;
private final BeforeActionListener beforeStateChangeListener;
private final StateManager stateManager;
+ private final SiteSignOutLink siteSignOutLink;
public TextEditorPresenter(final boolean isAutoSave, final ActionToolbar<StateToken> toolbar,
- final I18nUITranslationService i18n, StateManager stateManager) {
+ final I18nUITranslationService i18n, StateManager stateManager, SiteSignOutLink siteSignOutLink) {
this.toolbar = toolbar;
autoSave = isAutoSave;
this.i18n = i18n;
this.stateManager = stateManager;
+ this.siteSignOutLink = siteSignOutLink;
savePending = false;
editingHtml = false;
saveAndCloseConfirmed = false;
@@ -78,6 +81,7 @@
view.attach();
setContent(content);
stateManager.addBeforeStateChangeListener(beforeStateChangeListener);
+ siteSignOutLink.addBeforeSignOut(beforeStateChangeListener);
}
public String getContent() {
@@ -142,6 +146,7 @@
protected void onCancelConfirmed() {
stateManager.removeBeforeStateChangeListener(beforeStateChangeListener);
+ siteSignOutLink.removeBeforeSignOut(beforeStateChangeListener);
stateManager.resumeTokenChange();
reset();
view.detach();
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/sitesign/SiteSignOutLink.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/sitesign/SiteSignOutLink.java 2008-11-04 15:07:14 UTC (rev 939)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/sitesign/SiteSignOutLink.java 2008-11-05 22:07:07 UTC (rev 940)
@@ -18,6 +18,12 @@
*
*/package org.ourproject.kune.workspace.client.sitebar.sitesign;
+import org.ourproject.kune.platf.client.actions.BeforeActionListener;
+
public interface SiteSignOutLink {
+ void addBeforeSignOut(BeforeActionListener listener);
+
+ void removeBeforeSignOut(BeforeActionListener listener);
+
}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/sitesign/SiteSignOutLinkPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/sitesign/SiteSignOutLinkPresenter.java 2008-11-04 15:07:14 UTC (rev 939)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/sitesign/SiteSignOutLinkPresenter.java 2008-11-05 22:07:07 UTC (rev 940)
@@ -21,6 +21,8 @@
import java.util.Date;
import org.ourproject.kune.platf.client.View;
+import org.ourproject.kune.platf.client.actions.BeforeActionCollection;
+import org.ourproject.kune.platf.client.actions.BeforeActionListener;
import org.ourproject.kune.platf.client.dto.UserInfoDTO;
import org.ourproject.kune.platf.client.errors.SessionExpiredException;
import org.ourproject.kune.platf.client.errors.UserMustBeLoggedException;
@@ -41,6 +43,7 @@
private SiteSignOutLinkView view;
private final Session session;
private final Provider<UserServiceAsync> userServiceProvider;
+ private final BeforeActionCollection beforeSignOutCollection;
public SiteSignOutLinkPresenter(final Session session, final Provider<UserServiceAsync> userServiceProvider,
final Provider<KuneErrorHandler> kuneErrorHandlerProvider) {
@@ -61,31 +64,39 @@
clientUIsignOut();
}
});
+ beforeSignOutCollection = new BeforeActionCollection();
}
+ public void addBeforeSignOut(BeforeActionListener listener) {
+ beforeSignOutCollection.add(listener);
+ }
+
public void doSignOut() {
- final AsyncCallback<Object> callback = new AsyncCallback<Object>() {
- public void onFailure(final Throwable caught) {
- Site.hideProgress();
- try {
- throw caught;
- } catch (final SessionExpiredException e) {
+ if (beforeSignOutCollection.checkBeforeAction()) {
+ userServiceProvider.get().logout(session.getUserHash(), new AsyncCallback<Object>() {
+ public void onFailure(final Throwable caught) {
+ Site.hideProgress();
+ try {
+ throw caught;
+ } catch (final SessionExpiredException e) {
+ clientUIsignOut();
+ } catch (final UserMustBeLoggedException e) {
+ clientUIsignOut();
+ } catch (final Throwable e) {
+ GWT.log("Other kind of exception in doLogout", null);
+ throw new RuntimeException();
+ }
+ }
+
+ public void onSuccess(final Object arg0) {
+ Site.hideProgress();
clientUIsignOut();
- } catch (final UserMustBeLoggedException e) {
- clientUIsignOut();
- } catch (final Throwable e) {
- GWT.log("Other kind of exception in doLogout", null);
- throw new RuntimeException();
}
- }
- public void onSuccess(final Object arg0) {
- Site.hideProgress();
- clientUIsignOut();
- }
-
- };
- userServiceProvider.get().logout(session.getUserHash(), callback);
+ });
+ } else {
+ Site.hideProgress();
+ }
}
public View getView() {
@@ -97,6 +108,10 @@
view.setVisible(false);
}
+ public void removeBeforeSignOut(BeforeActionListener listener) {
+ beforeSignOutCollection.remove(listener);
+ }
+
private void clientUIsignOut() {
// FIXME: Remove cookie doesn't works in all browsers, know
// issue:
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/BuddiesSummaryPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/BuddiesSummaryPresenter.java 2008-11-04 15:07:14 UTC (rev 939)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/BuddiesSummaryPresenter.java 2008-11-05 22:07:07 UTC (rev 940)
@@ -20,7 +20,7 @@
import java.util.List;
-import org.ourproject.kune.chat.client.ChatClientTool;
+import org.ourproject.kune.chat.client.ChatEngine;
import org.ourproject.kune.platf.client.View;
import org.ourproject.kune.platf.client.actions.ActionEnableCondition;
import org.ourproject.kune.platf.client.actions.ActionMenuItemDescriptor;
@@ -46,16 +46,16 @@
private final StateManager stateManager;
private final UserActionRegistry actionRegistry;
private final I18nTranslationService i18n;
- private final Provider<ChatClientTool> chatClientToolProvider;
+ private final Provider<ChatEngine> chatEngineProvider;
private final Session session;
public BuddiesSummaryPresenter(StateManager stateManager, final Session session, UserActionRegistry actionRegistry,
- I18nTranslationService i18n, final Provider<ChatClientTool> chatClientToolProvider) {
+ I18nTranslationService i18n, final Provider<ChatEngine> chatEngineProvider) {
this.stateManager = stateManager;
this.session = session;
this.actionRegistry = actionRegistry;
this.i18n = i18n;
- this.chatClientToolProvider = chatClientToolProvider;
+ this.chatEngineProvider = chatEngineProvider;
stateManager.onStateChanged(new Listener<StateAbstractDTO>() {
public void onEvent(StateAbstractDTO state) {
setState(state);
@@ -118,7 +118,7 @@
final ActionToolbarButtonAndItemDescriptor<UserSimpleDTO> addAsBuddie = new ActionToolbarButtonAndItemDescriptor<UserSimpleDTO>(
AccessRolDTO.Viewer, ActionToolbarPosition.bottombar, new Listener<UserSimpleDTO>() {
public void onEvent(final UserSimpleDTO group) {
- chatClientToolProvider.get().getChat().addNewBuddie(group.getShortName());
+ chatEngineProvider.get().addNewBuddie(group.getShortName());
}
});
addAsBuddie.setMustBeAuthenticated(true);
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-11-04 15:07:14 UTC (rev 939)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/GroupMembersSummaryPresenter.java 2008-11-05 22:07:07 UTC (rev 940)
@@ -20,10 +20,12 @@
import java.util.List;
+import org.ourproject.kune.chat.client.ChatEngine;
import org.ourproject.kune.platf.client.dto.AccessListsDTO;
import org.ourproject.kune.platf.client.dto.AccessRightsDTO;
import org.ourproject.kune.platf.client.dto.GroupDTO;
import org.ourproject.kune.platf.client.dto.GroupType;
+import org.ourproject.kune.platf.client.dto.InitDataDTO;
import org.ourproject.kune.platf.client.dto.LinkDTO;
import org.ourproject.kune.platf.client.dto.SocialNetworkDTO;
import org.ourproject.kune.platf.client.dto.SocialNetworkResultDTO;
@@ -34,6 +36,7 @@
import org.ourproject.kune.platf.client.services.ImageUtils;
import org.ourproject.kune.platf.client.state.Session;
import org.ourproject.kune.platf.client.state.StateManager;
+import org.ourproject.kune.platf.client.ui.MenuItem;
import org.ourproject.kune.platf.client.ui.gridmenu.GridButton;
import org.ourproject.kune.platf.client.ui.gridmenu.GridGroup;
import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService;
@@ -42,6 +45,7 @@
import org.ourproject.kune.workspace.client.themes.WsTheme;
import org.ourproject.kune.workspace.client.themes.WsThemePresenter;
+import com.calclab.emite.core.client.xmpp.stanzas.XmppURI;
import com.calclab.suco.client.ioc.Provider;
import com.calclab.suco.client.listener.Listener;
import com.calclab.suco.client.listener.Listener2;
@@ -61,7 +65,8 @@
public GroupMembersSummaryPresenter(final I18nUITranslationService i18n, final StateManager stateManager,
final ImageUtils imageUtils, final Session session,
final Provider<SocialNetworkServiceAsync> snServiceProvider,
- final Provider<GroupLiveSearcher> liveSearcherProvider, final WsThemePresenter wsThemePresenter) {
+ final Provider<GroupLiveSearcher> liveSearcherProvider, final WsThemePresenter wsThemePresenter,
+ final Provider<ChatEngine> chatEngineProvider) {
super(i18n, stateManager, imageUtils, session, snServiceProvider);
this.i18n = i18n;
this.stateManager = stateManager;
@@ -79,6 +84,22 @@
view.setTheme(oldTheme, newTheme);
}
});
+ session.onInitDataReceived(new Listener<InitDataDTO>() {
+ public void onEvent(final InitDataDTO initData) {
+ addUserOperation(new MenuItem<GroupDTO>("images/new-chat.gif", i18n.t("Start a chat with this member"),
+ new Listener<GroupDTO>() {
+ public void onEvent(final GroupDTO group) {
+ chatEngineProvider.get().show();
+ if (chatEngineProvider.get().isLoggedIn()) {
+ chatEngineProvider.get().chat(
+ XmppURI.jid(group.getShortName() + "@" + initData.getChatDomain()));
+ } else {
+ Site.important(i18n.t("To start a chat you need to be 'online'."));
+ }
+ }
+ }), true);
+ }
+ });
final String adminsTitle = i18n.t("Admins");
final String collabsTitle = i18n.t("Collaborators");
final String pendingTitle = i18n.t("Pending");
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/title/EntitySubTitlePresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/title/EntitySubTitlePresenter.java 2008-11-04 15:07:14 UTC (rev 939)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/title/EntitySubTitlePresenter.java 2008-11-05 22:07:07 UTC (rev 940)
@@ -44,6 +44,9 @@
setState((StateContentDTO) state);
} else if (state instanceof StateContainerDTO) {
setState((StateContainerDTO) state);
+ } else {
+ view.setContentSubTitleLeftVisible(false);
+ view.setContentSubTitleRightVisible(false);
}
}
});
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-11-04 15:07:14 UTC (rev 939)
+++ trunk/src/test/java/org/ourproject/kune/platf/client/state/StateManagerTest.java 2008-11-05 22:07:07 UTC (rev 940)
@@ -5,6 +5,7 @@
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mockito;
+import org.ourproject.kune.platf.client.actions.BeforeActionListener;
import org.ourproject.kune.platf.client.app.HistoryWrapper;
import org.ourproject.kune.platf.client.dto.StateAbstractDTO;
import org.ourproject.kune.platf.client.dto.StateToken;
Modified: trunk/src/test/java/org/ourproject/kune/workspace/client/editor/TextEditorPresenterTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/workspace/client/editor/TextEditorPresenterTest.java 2008-11-04 15:07:14 UTC (rev 939)
+++ trunk/src/test/java/org/ourproject/kune/workspace/client/editor/TextEditorPresenterTest.java 2008-11-05 22:07:07 UTC (rev 940)
@@ -9,6 +9,7 @@
import org.ourproject.kune.platf.client.actions.toolbar.ActionToolbar;
import org.ourproject.kune.platf.client.state.StateManager;
import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService;
+import org.ourproject.kune.workspace.client.sitebar.sitesign.SiteSignOutLink;
import com.calclab.suco.testing.listener.MockListener;
import com.calclab.suco.testing.listener.MockListener0;
@@ -21,6 +22,7 @@
@SuppressWarnings("unchecked")
private ActionToolbar toolbar;
private StateManager stateManager;
+ private SiteSignOutLink signOutLink;
@SuppressWarnings("unchecked")
@Before
@@ -28,7 +30,8 @@
I18nUITranslationService i18n = Mockito.mock(I18nUITranslationService.class);
stateManager = Mockito.mock(StateManager.class);
toolbar = Mockito.mock(ActionToolbar.class);
- presenter = new TextEditorPresenter(true, toolbar, i18n, stateManager);
+ signOutLink = Mockito.mock(SiteSignOutLink.class);
+ presenter = new TextEditorPresenter(true, toolbar, i18n, stateManager, signOutLink);
view = Mockito.mock(TextEditorView.class);
presenter.init(view);
saveListener = new MockListener<String>();
1
0
Author: vjrj
Date: 2008-11-04 16:07:14 +0100 (Tue, 04 Nov 2008)
New Revision: 939
Added:
trunk/src/main/java/org/ourproject/kune/chat/client/ChatConnectionOptions.java
trunk/src/main/java/org/ourproject/kune/chat/client/cnt/info/ChatInfoPanel.java
trunk/src/main/java/org/ourproject/kune/chat/client/cnt/room/ChatRoomControlPanel.java
trunk/src/main/java/org/ourproject/kune/chat/client/cnt/room/ChatRoomPanel.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/reader/DocumentViewer.java
trunk/src/main/java/org/ourproject/kune/docs/client/cnt/reader/DocumentViewerPanel.java
trunk/src/main/java/org/ourproject/kune/docs/client/cnt/reader/DocumentViewerPresenter.java
trunk/src/main/java/org/ourproject/kune/docs/client/cnt/reader/DocumentViewerView.java
trunk/src/main/java/org/ourproject/kune/docs/client/ctx/admin/DocContextEditor.java
trunk/src/main/java/org/ourproject/kune/docs/client/ctx/admin/DocContextEditorPanel.java
trunk/src/main/java/org/ourproject/kune/docs/client/ctx/admin/DocContextEditorPresenter.java
trunk/src/main/java/org/ourproject/kune/docs/client/ctx/admin/DocContextEditorView.java
trunk/src/main/java/org/ourproject/kune/platf/client/state/BeforeActionListener.java
Removed:
trunk/src/main/java/org/ourproject/kune/chat/client/ChatOptions.java
trunk/src/main/java/org/ourproject/kune/chat/client/ChatProvider.java
trunk/src/main/java/org/ourproject/kune/chat/client/cnt/info/ui/ChatInfoPanel.java
trunk/src/main/java/org/ourproject/kune/chat/client/cnt/room/ui/ChatRoomControlPanel.java
trunk/src/main/java/org/ourproject/kune/chat/client/cnt/room/ui/ChatRoomPanel.java
trunk/src/main/java/org/ourproject/kune/chat/client/ctx/ui/
trunk/src/main/java/org/ourproject/kune/docs/client/Document.java
trunk/src/main/java/org/ourproject/kune/docs/client/actions/
trunk/src/main/java/org/ourproject/kune/docs/client/cnt/folder/viewer/ui/
trunk/src/main/java/org/ourproject/kune/docs/client/cnt/reader/DocumentReader.java
trunk/src/main/java/org/ourproject/kune/docs/client/cnt/reader/DocumentReaderPresenter.java
trunk/src/main/java/org/ourproject/kune/docs/client/cnt/reader/DocumentReaderView.java
trunk/src/main/java/org/ourproject/kune/docs/client/cnt/reader/ui/
trunk/src/main/java/org/ourproject/kune/docs/client/ctx/admin/AdminContext.java
trunk/src/main/java/org/ourproject/kune/docs/client/ctx/admin/AdminContextPanel.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/AdminContextView.java
trunk/src/main/java/org/ourproject/kune/docs/client/ctx/admin/ui/
trunk/src/main/java/org/ourproject/kune/platf/client/state/BeforeStateChangeListener.java
Modified:
trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientModule.java
trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientTool.java
trunk/src/main/java/org/ourproject/kune/chat/client/ChatEngine.java
trunk/src/main/java/org/ourproject/kune/chat/client/ChatEngineXmpp.java
trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientActions.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/docs/client/ctx/DocumentContextPresenter.java
trunk/src/main/java/org/ourproject/kune/platf/client/state/BeforeStateChangeCollection.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/workspace/client/editor/TextEditorPresenter.java
trunk/src/test/java/org/ourproject/kune/platf/client/state/StateManagerTest.java
trunk/src/test/java/org/ourproject/kune/platf/integration/selenium/KuneSeleniumTestHelper.java
Log:
Incomplete - task UI tools & workspace refactorization
Complete - task StateManager refactor
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-04 12:32:31 UTC (rev 938)
+++ trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientModule.java 2008-11-04 15:07:14 UTC (rev 939)
@@ -21,13 +21,13 @@
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.ui.ChatInfoPanel;
+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.ChatRoomControl;
+import org.ourproject.kune.chat.client.cnt.room.ChatRoomControlPanel;
import org.ourproject.kune.chat.client.cnt.room.ChatRoomControlPresenter;
+import org.ourproject.kune.chat.client.cnt.room.ChatRoomPanel;
import org.ourproject.kune.chat.client.cnt.room.ChatRoomPresenter;
-import org.ourproject.kune.chat.client.cnt.room.ui.ChatRoomControlPanel;
-import org.ourproject.kune.chat.client.cnt.room.ui.ChatRoomPanel;
import org.ourproject.kune.chat.client.ctx.ChatContext;
import org.ourproject.kune.chat.client.ctx.ChatContextPresenter;
import org.ourproject.kune.chat.client.ctx.rooms.RoomsAdmin;
@@ -53,19 +53,9 @@
public class ChatClientModule extends AbstractModule {
- public ChatClientModule() {
- }
-
@Override
public void onInstall() {
- register(Singleton.class, new Factory<ChatInfo>(ChatInfo.class) {
- @Override
- public ChatInfo create() {
- return new ChatInfoPanel();
- }
- });
-
register(ToolGroup.class, new Factory<ChatClientActions>(ChatClientActions.class) {
@Override
public ChatClientActions create() {
@@ -74,6 +64,22 @@
}
});
+ register(ToolGroup.class, new Factory<ChatClientTool>(ChatClientTool.class) {
+ @Override
+ public ChatClientTool create() {
+ return new ChatClientTool($(Session.class), $(Application.class), $(I18nUITranslationService.class),
+ $(EmiteUIDialog.class), $(WorkspaceSkeleton.class), $$(GroupMembersSummary.class),
+ $(ToolSelector.class), $(WsThemePresenter.class), $$(ChatContent.class), $$(ChatContext.class));
+ }
+ });
+
+ 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() {
@@ -110,6 +116,7 @@
return presenter;
}
});
+
register(Singleton.class, new Factory<RoomsAdmin>(RoomsAdmin.class) {
@Override
public RoomsAdmin create() {
@@ -120,14 +127,5 @@
}
});
- register(ToolGroup.class, new Factory<ChatClientTool>(ChatClientTool.class) {
- @Override
- public ChatClientTool create() {
- return new ChatClientTool($(Session.class), $(Application.class), $(I18nUITranslationService.class),
- $(EmiteUIDialog.class), $(WorkspaceSkeleton.class), $$(GroupMembersSummary.class),
- $(ToolSelector.class), $(WsThemePresenter.class), $$(ChatContent.class), $$(ChatContext.class));
- }
- });
-
}
}
Modified: trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientTool.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientTool.java 2008-11-04 12:32:31 UTC (rev 938)
+++ trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientTool.java 2008-11-04 15:07:14 UTC (rev 939)
@@ -43,7 +43,7 @@
import com.calclab.suco.client.listener.Listener;
import com.calclab.suco.client.listener.Listener0;
-public class ChatClientTool extends AbstractClientTool implements ChatProvider {
+public class ChatClientTool extends AbstractClientTool {
public static final String NAME = "chats";
public static final String TYPE_ROOT = "chat.root";
public static final String TYPE_ROOM = "chat.room";
@@ -63,8 +63,8 @@
session.onInitDataReceived(new Listener<InitDataDTO>() {
public void onEvent(final InitDataDTO initData) {
checkChatDomain(initData.getChatDomain());
- final ChatOptions chatOptions = new ChatOptions(initData.getChatHttpBase(), initData.getChatDomain(),
- initData.getChatRoomHost());
+ final ChatConnectionOptions chatOptions = new ChatConnectionOptions(initData.getChatHttpBase(),
+ initData.getChatDomain(), initData.getChatRoomHost());
chat = new ChatEngineXmpp(emiteUIDialog, chatOptions, i18n, ws);
groupMembersSummaryProvider.get().addUserOperation(
new MenuItem<GroupDTO>("images/new-chat.gif", i18n.t("Start a chat with this member"),
Copied: trunk/src/main/java/org/ourproject/kune/chat/client/ChatConnectionOptions.java (from rev 934, trunk/src/main/java/org/ourproject/kune/chat/client/ChatOptions.java)
===================================================================
--- trunk/src/main/java/org/ourproject/kune/chat/client/ChatOptions.java 2008-10-28 15:40:27 UTC (rev 934)
+++ trunk/src/main/java/org/ourproject/kune/chat/client/ChatConnectionOptions.java 2008-11-04 15:07:14 UTC (rev 939)
@@ -0,0 +1,36 @@
+/*
+ *
+ * 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 com.calclab.emiteuimodule.client.UserChatOptions;
+
+public class ChatConnectionOptions {
+ public UserChatOptions userOptions;
+ public final String httpBase;
+ public final String domain;
+ public final String roomHost;
+
+ public ChatConnectionOptions(final String httpBase, final String domain, final String roomHost) {
+ this.httpBase = httpBase;
+ this.domain = domain;
+ this.roomHost = roomHost;
+ userOptions = null;
+ }
+}
Property changes on: trunk/src/main/java/org/ourproject/kune/chat/client/ChatConnectionOptions.java
___________________________________________________________________
Name: svn:mergeinfo
+
Modified: trunk/src/main/java/org/ourproject/kune/chat/client/ChatEngine.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/chat/client/ChatEngine.java 2008-11-04 12:32:31 UTC (rev 938)
+++ trunk/src/main/java/org/ourproject/kune/chat/client/ChatEngine.java 2008-11-04 15:07:14 UTC (rev 939)
@@ -22,7 +22,7 @@
public interface ChatEngine {
void addNewBuddie(String shortName);
- ChatOptions getChatOptions();
+ ChatConnectionOptions getChatOptions();
void joinRoom(String roomName, String userAlias);
Modified: trunk/src/main/java/org/ourproject/kune/chat/client/ChatEngineXmpp.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/chat/client/ChatEngineXmpp.java 2008-11-04 12:32:31 UTC (rev 938)
+++ trunk/src/main/java/org/ourproject/kune/chat/client/ChatEngineXmpp.java 2008-11-04 15:07:14 UTC (rev 939)
@@ -39,13 +39,13 @@
import com.gwtext.client.widgets.event.ButtonListenerAdapter;
class ChatEngineXmpp implements ChatEngine {
- private final ChatOptions chatOptions;
+ private final ChatConnectionOptions chatOptions;
private final EmiteUIDialog emiteDialog;
private final I18nTranslationService i18n;
private final WorkspaceSkeleton ws;
private ToolbarButton traybarButton;
- public ChatEngineXmpp(final EmiteUIDialog emiteUIDialog, final ChatOptions chatOptions,
+ public ChatEngineXmpp(final EmiteUIDialog emiteUIDialog, final ChatConnectionOptions chatOptions,
final I18nTranslationService i18n, final WorkspaceSkeleton ws) {
this.emiteDialog = emiteUIDialog;
this.chatOptions = chatOptions;
@@ -57,7 +57,7 @@
Site.important("In development (emite)");
}
- public ChatOptions getChatOptions() {
+ public ChatConnectionOptions getChatOptions() {
return chatOptions;
}
Deleted: trunk/src/main/java/org/ourproject/kune/chat/client/ChatOptions.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/chat/client/ChatOptions.java 2008-11-04 12:32:31 UTC (rev 938)
+++ trunk/src/main/java/org/ourproject/kune/chat/client/ChatOptions.java 2008-11-04 15:07:14 UTC (rev 939)
@@ -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.chat.client;
-
-import com.calclab.emiteuimodule.client.UserChatOptions;
-
-public class ChatOptions {
- public UserChatOptions userOptions;
- public final String httpBase;
- public final String domain;
- public final String roomHost;
-
- public ChatOptions(final String httpBase, final String domain, final String roomHost) {
- this.httpBase = httpBase;
- this.domain = domain;
- this.roomHost = roomHost;
- userOptions = null;
- }
-}
Deleted: trunk/src/main/java/org/ourproject/kune/chat/client/ChatProvider.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/chat/client/ChatProvider.java 2008-11-04 12:32:31 UTC (rev 938)
+++ trunk/src/main/java/org/ourproject/kune/chat/client/ChatProvider.java 2008-11-04 15:07:14 UTC (rev 939)
@@ -1,24 +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 ChatProvider {
- ChatEngine getChat();
-}
Copied: trunk/src/main/java/org/ourproject/kune/chat/client/cnt/info/ChatInfoPanel.java (from rev 934, trunk/src/main/java/org/ourproject/kune/chat/client/cnt/info/ui/ChatInfoPanel.java)
===================================================================
--- trunk/src/main/java/org/ourproject/kune/chat/client/cnt/info/ui/ChatInfoPanel.java 2008-10-28 15:40:27 UTC (rev 934)
+++ trunk/src/main/java/org/ourproject/kune/chat/client/cnt/info/ChatInfoPanel.java 2008-11-04 15:07:14 UTC (rev 939)
@@ -0,0 +1,39 @@
+/*
+ *
+ * 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.info;
+
+
+import com.google.gwt.user.client.ui.FlowPanel;
+import com.google.gwt.user.client.ui.VerticalPanel;
+
+@Deprecated
+public class ChatInfoPanel extends VerticalPanel implements ChatInfo {
+ private final VerticalPanel stateArea;
+
+ public ChatInfoPanel() {
+ final FlowPanel flow = new FlowPanel();
+ add(flow);
+ stateArea = new VerticalPanel();
+ add(stateArea);
+ }
+
+ public void show() {
+ }
+}
Property changes on: trunk/src/main/java/org/ourproject/kune/chat/client/cnt/info/ChatInfoPanel.java
___________________________________________________________________
Name: svn:mergeinfo
+
Deleted: trunk/src/main/java/org/ourproject/kune/chat/client/cnt/info/ui/ChatInfoPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/chat/client/cnt/info/ui/ChatInfoPanel.java 2008-11-04 12:32:31 UTC (rev 938)
+++ trunk/src/main/java/org/ourproject/kune/chat/client/cnt/info/ui/ChatInfoPanel.java 2008-11-04 15:07:14 UTC (rev 939)
@@ -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.chat.client.cnt.info.ui;
-
-import org.ourproject.kune.chat.client.cnt.info.ChatInfo;
-
-import com.google.gwt.user.client.ui.FlowPanel;
-import com.google.gwt.user.client.ui.VerticalPanel;
-
-public class ChatInfoPanel extends VerticalPanel implements ChatInfo {
- private final VerticalPanel stateArea;
-
- public ChatInfoPanel() {
- final FlowPanel flow = new FlowPanel();
- add(flow);
- stateArea = new VerticalPanel();
- add(stateArea);
- }
-
- public void show() {
- }
-}
Copied: trunk/src/main/java/org/ourproject/kune/chat/client/cnt/room/ChatRoomControlPanel.java (from rev 934, trunk/src/main/java/org/ourproject/kune/chat/client/cnt/room/ui/ChatRoomControlPanel.java)
===================================================================
--- trunk/src/main/java/org/ourproject/kune/chat/client/cnt/room/ui/ChatRoomControlPanel.java 2008-10-28 15:40:27 UTC (rev 934)
+++ trunk/src/main/java/org/ourproject/kune/chat/client/cnt/room/ChatRoomControlPanel.java 2008-11-04 15:07:14 UTC (rev 939)
@@ -0,0 +1,46 @@
+/*
+ *
+ * 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.room;
+
+import org.ourproject.kune.platf.client.services.I18nTranslationService;
+import org.ourproject.kune.platf.client.ui.CustomPushButton;
+
+import com.google.gwt.user.client.ui.ClickListener;
+import com.google.gwt.user.client.ui.HorizontalPanel;
+import com.google.gwt.user.client.ui.Widget;
+
+public class ChatRoomControlPanel extends HorizontalPanel implements ChatRoomControlView {
+ private final CustomPushButton enterRoomBtn;
+
+ public ChatRoomControlPanel(final I18nTranslationService i18n, final ChatRoomControlPresenter presenter) {
+ enterRoomBtn = new CustomPushButton(i18n.t("Enter room"), new ClickListener() {
+ public void onClick(final Widget sender) {
+ presenter.onEnterRoom();
+ }
+ });
+ add(enterRoomBtn);
+ setEnterRoomEnabled(true);
+ }
+
+ public void setEnterRoomEnabled(final boolean isEnabled) {
+ enterRoomBtn.setEnabled(isEnabled);
+ }
+
+}
\ No newline at end of file
Property changes on: trunk/src/main/java/org/ourproject/kune/chat/client/cnt/room/ChatRoomControlPanel.java
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: trunk/src/main/java/org/ourproject/kune/chat/client/cnt/room/ChatRoomPanel.java (from rev 934, trunk/src/main/java/org/ourproject/kune/chat/client/cnt/room/ui/ChatRoomPanel.java)
===================================================================
--- trunk/src/main/java/org/ourproject/kune/chat/client/cnt/room/ui/ChatRoomPanel.java 2008-10-28 15:40:27 UTC (rev 934)
+++ trunk/src/main/java/org/ourproject/kune/chat/client/cnt/room/ChatRoomPanel.java 2008-11-04 15:07:14 UTC (rev 939)
@@ -0,0 +1,33 @@
+/*
+ *
+ * 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.room;
+
+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 ChatRoomPanel implements ChatRoomView {
+
+ public ChatRoomPanel(final WorkspaceSkeleton ws) {
+ ws.getEntityWorkspace().setContent(new Label("History of room conversations." + Site.IN_DEVELOPMENT));
+ }
+
+}
Property changes on: trunk/src/main/java/org/ourproject/kune/chat/client/cnt/room/ChatRoomPanel.java
___________________________________________________________________
Name: svn:mergeinfo
+
Deleted: trunk/src/main/java/org/ourproject/kune/chat/client/cnt/room/ui/ChatRoomControlPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/chat/client/cnt/room/ui/ChatRoomControlPanel.java 2008-11-04 12:32:31 UTC (rev 938)
+++ trunk/src/main/java/org/ourproject/kune/chat/client/cnt/room/ui/ChatRoomControlPanel.java 2008-11-04 15:07:14 UTC (rev 939)
@@ -1,48 +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.room.ui;
-
-import org.ourproject.kune.chat.client.cnt.room.ChatRoomControlPresenter;
-import org.ourproject.kune.chat.client.cnt.room.ChatRoomControlView;
-import org.ourproject.kune.platf.client.services.I18nTranslationService;
-import org.ourproject.kune.platf.client.ui.CustomPushButton;
-
-import com.google.gwt.user.client.ui.ClickListener;
-import com.google.gwt.user.client.ui.HorizontalPanel;
-import com.google.gwt.user.client.ui.Widget;
-
-public class ChatRoomControlPanel extends HorizontalPanel implements ChatRoomControlView {
- private final CustomPushButton enterRoomBtn;
-
- public ChatRoomControlPanel(final I18nTranslationService i18n, final ChatRoomControlPresenter presenter) {
- enterRoomBtn = new CustomPushButton(i18n.t("Enter room"), new ClickListener() {
- public void onClick(final Widget sender) {
- presenter.onEnterRoom();
- }
- });
- add(enterRoomBtn);
- setEnterRoomEnabled(true);
- }
-
- public void setEnterRoomEnabled(final boolean isEnabled) {
- enterRoomBtn.setEnabled(isEnabled);
- }
-
-}
\ No newline at end of file
Deleted: trunk/src/main/java/org/ourproject/kune/chat/client/cnt/room/ui/ChatRoomPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/chat/client/cnt/room/ui/ChatRoomPanel.java 2008-11-04 12:32:31 UTC (rev 938)
+++ trunk/src/main/java/org/ourproject/kune/chat/client/cnt/room/ui/ChatRoomPanel.java 2008-11-04 15:07:14 UTC (rev 939)
@@ -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.chat.client.cnt.room.ui;
-
-import org.ourproject.kune.chat.client.cnt.room.ChatRoomView;
-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 ChatRoomPanel implements ChatRoomView {
-
- public ChatRoomPanel(final WorkspaceSkeleton ws) {
- ws.getEntityWorkspace().setContent(new Label("History of room conversations." + Site.IN_DEVELOPMENT));
- }
-
-}
Deleted: trunk/src/main/java/org/ourproject/kune/docs/client/Document.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/Document.java 2008-11-04 12:32:31 UTC (rev 938)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/Document.java 2008-11-04 15:07:14 UTC (rev 939)
@@ -1,24 +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;
-
-public interface Document {
-
-}
Modified: trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientActions.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientActions.java 2008-11-04 12:32:31 UTC (rev 938)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientActions.java 2008-11-04 15:07:14 UTC (rev 939)
@@ -29,7 +29,7 @@
import static org.ourproject.kune.docs.client.DocumentClientTool.TYPE_WIKIPAGE;
import org.ourproject.kune.docs.client.cnt.DocumentContent;
-import org.ourproject.kune.docs.client.ctx.admin.AdminContext;
+import org.ourproject.kune.docs.client.ctx.admin.DocContextEditor;
import org.ourproject.kune.platf.client.actions.ActionEnableCondition;
import org.ourproject.kune.platf.client.actions.ActionMenuItemDescriptor;
import org.ourproject.kune.platf.client.actions.ActionToolbarButtonAndItemDescriptor;
@@ -87,7 +87,7 @@
private final Provider<TextEditor> textEditorProvider;
private final KuneErrorHandler errorHandler;
private final DocumentContent documentContent;
- private final Provider<AdminContext> adminContextProvider;
+ private final Provider<DocContextEditor> adminContextProvider;
public DocumentClientActions(final I18nUITranslationService i18n, final ContextNavigator contextNavigator,
final Session session, final StateManager stateManager,
@@ -96,7 +96,7 @@
final ContentActionRegistry contentActionRegistry, final ContextActionRegistry contextActionRegistry,
final Provider<FileDownloadUtils> fileDownloadProvider, final EntityLogo entityLogo,
final Provider<TextEditor> textEditorProvider, final KuneErrorHandler errorHandler,
- final DocumentContent documentContent, final Provider<AdminContext> adminContextProvider) {
+ final DocumentContent documentContent, final Provider<DocContextEditor> adminContextProvider) {
this.i18n = i18n;
this.contextNavigator = contextNavigator;
this.session = session;
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-04 12:32:31 UTC (rev 938)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientModule.java 2008-11-04 15:07:14 UTC (rev 939)
@@ -22,19 +22,19 @@
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.ui.FolderViewerPanel;
-import org.ourproject.kune.docs.client.cnt.reader.DocumentReader;
-import org.ourproject.kune.docs.client.cnt.reader.DocumentReaderPresenter;
-import org.ourproject.kune.docs.client.cnt.reader.DocumentReaderView;
-import org.ourproject.kune.docs.client.cnt.reader.ui.DocumentReaderPanel;
+import org.ourproject.kune.docs.client.cnt.reader.DocumentViewer;
+import org.ourproject.kune.docs.client.cnt.reader.DocumentViewerPanel;
+import org.ourproject.kune.docs.client.cnt.reader.DocumentViewerPresenter;
+import org.ourproject.kune.docs.client.cnt.reader.DocumentViewerView;
import org.ourproject.kune.docs.client.ctx.DocumentContext;
import org.ourproject.kune.docs.client.ctx.DocumentContextPresenter;
-import org.ourproject.kune.docs.client.ctx.admin.AdminContext;
-import org.ourproject.kune.docs.client.ctx.admin.AdminContextPanel;
-import org.ourproject.kune.docs.client.ctx.admin.AdminContextPresenter;
-import org.ourproject.kune.docs.client.ctx.admin.AdminContextView;
+import org.ourproject.kune.docs.client.ctx.admin.DocContextEditor;
+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;
@@ -70,9 +70,6 @@
public class DocumentClientModule extends AbstractModule {
- public DocumentClientModule() {
- }
-
@Override
public void onInstall() {
@@ -94,7 +91,7 @@
$$(GroupServiceAsync.class), $$(FileUploader.class), $(ContentActionRegistry.class),
$(ContextActionRegistry.class), $$(FileDownloadUtils.class), $(EntityLogo.class),
$$(TextEditor.class), $(KuneErrorHandler.class), $(DocumentContent.class),
- $$(AdminContext.class));
+ $$(DocContextEditor.class));
}
});
@@ -107,7 +104,7 @@
contentNavigatorToolbar);
final DocumentContentPresenter presenter = new DocumentContentPresenter($(StateManager.class),
- $(Session.class), $$(DocumentReader.class), $$(TextEditor.class), $$(FolderViewer.class),
+ $(Session.class), $$(DocumentViewer.class), $$(TextEditor.class), $$(FolderViewer.class),
toolbar, $(ContentActionRegistry.class));
final DocumentContentPanel panel = new DocumentContentPanel($(WorkspaceSkeleton.class));
presenter.init(panel);
@@ -115,13 +112,13 @@
}
});
- register(Singleton.class, new Factory<AdminContext>(AdminContext.class) {
+ register(Singleton.class, new Factory<DocContextEditor>(DocContextEditor.class) {
@Override
- public AdminContext create() {
- final AdminContextPresenter presenter = new AdminContextPresenter($(Session.class),
+ public DocContextEditor create() {
+ final DocContextEditorPresenter presenter = new DocContextEditorPresenter($(Session.class),
$(StateManager.class), $$(TagsSummary.class), $$(ContentServiceAsync.class),
$(EntityTitle.class), $(EntitySubTitle.class));
- final AdminContextView view = new AdminContextPanel(presenter, $(I18nUITranslationService.class),
+ final DocContextEditorView view = new DocContextEditorPanel(presenter, $(I18nUITranslationService.class),
$(WorkspaceSkeleton.class));
presenter.init(view);
return presenter;
@@ -132,17 +129,17 @@
@Override
public DocumentContext create() {
final DocumentContextPresenter presenter = new DocumentContextPresenter($(StateManager.class),
- $$(ContextNavigator.class), $$(AdminContext.class));
+ $$(ContextNavigator.class), $$(DocContextEditor.class));
return presenter;
}
});
- register(Singleton.class, new Factory<DocumentReader>(DocumentReader.class) {
+ register(Singleton.class, new Factory<DocumentViewer>(DocumentViewer.class) {
@Override
- public DocumentReader create() {
- final DocumentReaderView view = new DocumentReaderPanel($(WorkspaceSkeleton.class),
+ public DocumentViewer create() {
+ final DocumentViewerView view = new DocumentViewerPanel($(WorkspaceSkeleton.class),
$(I18nTranslationService.class));
- final DocumentReaderPresenter presenter = new DocumentReaderPresenter(view, $$(FileDownloadUtils.class));
+ final DocumentViewerPresenter presenter = new DocumentViewerPresenter(view, $$(FileDownloadUtils.class));
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-04 12:32:31 UTC (rev 938)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/cnt/DocumentContentPresenter.java 2008-11-04 15:07:14 UTC (rev 939)
@@ -21,7 +21,7 @@
import org.ourproject.kune.docs.client.DocumentClientTool;
import org.ourproject.kune.docs.client.cnt.folder.viewer.FolderViewer;
-import org.ourproject.kune.docs.client.cnt.reader.DocumentReader;
+import org.ourproject.kune.docs.client.cnt.reader.DocumentViewer;
import org.ourproject.kune.platf.client.actions.ActionItemCollection;
import org.ourproject.kune.platf.client.actions.ActionRegistry;
import org.ourproject.kune.platf.client.actions.toolbar.ActionToolbar;
@@ -40,14 +40,14 @@
public class DocumentContentPresenter implements DocumentContent {
private DocumentContentView view;
private final Session session;
- private final Provider<DocumentReader> docReaderProvider;
+ 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<DocumentReader> docReaderProvider, final Provider<TextEditor> textEditorProvider,
+ final Provider<DocumentViewer> docReaderProvider, final Provider<TextEditor> textEditorProvider,
final Provider<FolderViewer> folderViewerProvider, final ActionToolbar<StateToken> toolbar,
final ActionRegistry<StateToken> actionRegistry) {
this.session = session;
Copied: trunk/src/main/java/org/ourproject/kune/docs/client/cnt/folder/viewer/FolderViewerPanel.java (from rev 934, trunk/src/main/java/org/ourproject/kune/docs/client/cnt/folder/viewer/ui/FolderViewerPanel.java)
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/cnt/folder/viewer/ui/FolderViewerPanel.java 2008-10-28 15:40:27 UTC (rev 934)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/cnt/folder/viewer/FolderViewerPanel.java 2008-11-04 15:07:14 UTC (rev 939)
@@ -0,0 +1,33 @@
+/*
+ *
+ * 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");
+ }
+}
Property changes on: trunk/src/main/java/org/ourproject/kune/docs/client/cnt/folder/viewer/FolderViewerPanel.java
___________________________________________________________________
Name: svn:mergeinfo
+
Deleted: trunk/src/main/java/org/ourproject/kune/docs/client/cnt/reader/DocumentReader.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/cnt/reader/DocumentReader.java 2008-11-04 12:32:31 UTC (rev 938)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/cnt/reader/DocumentReader.java 2008-11-04 15:07:14 UTC (rev 939)
@@ -1,31 +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.reader;
-
-import org.ourproject.kune.platf.client.View;
-import org.ourproject.kune.platf.client.dto.BasicMimeTypeDTO;
-import org.ourproject.kune.platf.client.dto.StateToken;
-
-public interface DocumentReader {
-
- View getView();
-
- void showDocument(StateToken token, String text, String typeId, BasicMimeTypeDTO mimeType);
-}
Deleted: trunk/src/main/java/org/ourproject/kune/docs/client/cnt/reader/DocumentReaderPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/cnt/reader/DocumentReaderPresenter.java 2008-11-04 12:32:31 UTC (rev 938)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/cnt/reader/DocumentReaderPresenter.java 2008-11-04 15:07:14 UTC (rev 939)
@@ -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.docs.client.cnt.reader;
-
-import org.ourproject.kune.docs.client.DocumentClientTool;
-import org.ourproject.kune.platf.client.View;
-import org.ourproject.kune.platf.client.dto.BasicMimeTypeDTO;
-import org.ourproject.kune.platf.client.dto.StateToken;
-import org.ourproject.kune.platf.client.ui.download.FileDownloadUtils;
-import org.ourproject.kune.platf.client.ui.download.ImageSize;
-
-import com.calclab.suco.client.ioc.Provider;
-
-public class DocumentReaderPresenter implements DocumentReader {
- private final DocumentReaderView view;
- private final Provider<FileDownloadUtils> downloadProvider;
-
- public DocumentReaderPresenter(final DocumentReaderView view, final Provider<FileDownloadUtils> downloadProvider) {
- this.view = view;
- this.downloadProvider = downloadProvider;
- }
-
- public View getView() {
- return view;
- }
-
- public void showDocument(final StateToken token, final String text, final String typeId,
- final BasicMimeTypeDTO mimeType) {
- if (typeId.equals(DocumentClientTool.TYPE_UPLOADEDFILE)) {
- if (mimeType != null) {
- FileDownloadUtils fileDownloadUtils = downloadProvider.get();
- if (mimeType.getType().equals("image")) {
- view.showImage(fileDownloadUtils.getImageUrl(token), fileDownloadUtils.getImageResizedUrl(token,
- ImageSize.sized));
- } else if (mimeType.toString().equals("text/plain") || mimeType.toString().equals("application/pdf")) {
- view.setContent(text);
- } else {
- view.setContent("");
- }
- }
- } else {
- view.setContent(text);
- }
- }
-}
Deleted: trunk/src/main/java/org/ourproject/kune/docs/client/cnt/reader/DocumentReaderView.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/cnt/reader/DocumentReaderView.java 2008-11-04 12:32:31 UTC (rev 938)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/cnt/reader/DocumentReaderView.java 2008-11-04 15:07:14 UTC (rev 939)
@@ -1,30 +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.reader;
-
-import org.ourproject.kune.platf.client.View;
-
-public interface DocumentReaderView extends View {
-
- void setContent(String content);
-
- void showImage(String imageUrl, String imageResizedUrl);
-
-}
Copied: trunk/src/main/java/org/ourproject/kune/docs/client/cnt/reader/DocumentViewer.java (from rev 934, trunk/src/main/java/org/ourproject/kune/docs/client/cnt/reader/DocumentReader.java)
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/cnt/reader/DocumentReader.java 2008-10-28 15:40:27 UTC (rev 934)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/cnt/reader/DocumentViewer.java 2008-11-04 15:07:14 UTC (rev 939)
@@ -0,0 +1,31 @@
+/*
+ *
+ * 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.reader;
+
+import org.ourproject.kune.platf.client.View;
+import org.ourproject.kune.platf.client.dto.BasicMimeTypeDTO;
+import org.ourproject.kune.platf.client.dto.StateToken;
+
+public interface DocumentViewer {
+
+ View getView();
+
+ void showDocument(StateToken token, String text, String typeId, BasicMimeTypeDTO mimeType);
+}
Property changes on: trunk/src/main/java/org/ourproject/kune/docs/client/cnt/reader/DocumentViewer.java
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: trunk/src/main/java/org/ourproject/kune/docs/client/cnt/reader/DocumentViewerPanel.java (from rev 934, trunk/src/main/java/org/ourproject/kune/docs/client/cnt/reader/ui/DocumentReaderPanel.java)
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/cnt/reader/ui/DocumentReaderPanel.java 2008-10-28 15:40:27 UTC (rev 934)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/cnt/reader/DocumentViewerPanel.java 2008-11-04 15:07:14 UTC (rev 939)
@@ -0,0 +1,73 @@
+/*
+ *
+ * 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.reader;
+
+import org.ourproject.kune.platf.client.services.I18nTranslationService;
+import org.ourproject.kune.platf.client.ui.KuneUiUtils;
+import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton;
+
+import com.google.gwt.user.client.ui.ClickListener;
+import com.google.gwt.user.client.ui.HTML;
+import com.google.gwt.user.client.ui.Image;
+import com.google.gwt.user.client.ui.Widget;
+
+public class DocumentViewerPanel implements DocumentViewerView {
+
+ private final WorkspaceSkeleton ws;
+ private final I18nTranslationService i18n;
+
+ public DocumentViewerPanel(final WorkspaceSkeleton ws, I18nTranslationService i18n) {
+ this.ws = ws;
+ this.i18n = i18n;
+ }
+
+ public void setContent(final String content) {
+ final HTML html = new HTML(content);
+ setDefStyle(html);
+ ws.getEntityWorkspace().setContent(html);
+ }
+
+ public void showImage(String imageUrl, String imageResizedUrl) {
+ final Image imgOrig = new Image(imageUrl);
+ final Image imgResized = new Image(imageResizedUrl);
+ KuneUiUtils.setQuickTip(imgOrig, i18n.t("Click to zoom out"));
+ KuneUiUtils.setQuickTip(imgResized, i18n.t("Click to zoom in"));
+ setDefStyle(imgOrig);
+ setDefStyle(imgResized);
+ imgOrig.addStyleName("kune-pointer");
+ imgResized.addStyleName("kune-pointer");
+ imgResized.addClickListener(new ClickListener() {
+ public void onClick(Widget sender) {
+ ws.getEntityWorkspace().setContent(imgOrig);
+ }
+ });
+ imgOrig.addClickListener(new ClickListener() {
+ public void onClick(Widget sender) {
+ ws.getEntityWorkspace().setContent(imgResized);
+ }
+ });
+ ws.getEntityWorkspace().setContent(imgResized);
+ }
+
+ private void setDefStyle(final Widget widget) {
+ widget.setStyleName("kune-Content-Main");
+ widget.addStyleName("kune-Margin-7-trbl");
+ }
+}
Property changes on: trunk/src/main/java/org/ourproject/kune/docs/client/cnt/reader/DocumentViewerPanel.java
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: trunk/src/main/java/org/ourproject/kune/docs/client/cnt/reader/DocumentViewerPresenter.java (from rev 934, trunk/src/main/java/org/ourproject/kune/docs/client/cnt/reader/DocumentReaderPresenter.java)
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/cnt/reader/DocumentReaderPresenter.java 2008-10-28 15:40:27 UTC (rev 934)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/cnt/reader/DocumentViewerPresenter.java 2008-11-04 15:07:14 UTC (rev 939)
@@ -0,0 +1,62 @@
+/*
+ *
+ * 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.reader;
+
+import org.ourproject.kune.docs.client.DocumentClientTool;
+import org.ourproject.kune.platf.client.View;
+import org.ourproject.kune.platf.client.dto.BasicMimeTypeDTO;
+import org.ourproject.kune.platf.client.dto.StateToken;
+import org.ourproject.kune.platf.client.ui.download.FileDownloadUtils;
+import org.ourproject.kune.platf.client.ui.download.ImageSize;
+
+import com.calclab.suco.client.ioc.Provider;
+
+public class DocumentViewerPresenter implements DocumentViewer {
+ private final DocumentViewerView view;
+ private final Provider<FileDownloadUtils> downloadProvider;
+
+ public DocumentViewerPresenter(final DocumentViewerView view, final Provider<FileDownloadUtils> downloadProvider) {
+ this.view = view;
+ this.downloadProvider = downloadProvider;
+ }
+
+ public View getView() {
+ return view;
+ }
+
+ public void showDocument(final StateToken token, final String text, final String typeId,
+ final BasicMimeTypeDTO mimeType) {
+ if (typeId.equals(DocumentClientTool.TYPE_UPLOADEDFILE)) {
+ if (mimeType != null) {
+ FileDownloadUtils fileDownloadUtils = downloadProvider.get();
+ if (mimeType.getType().equals("image")) {
+ view.showImage(fileDownloadUtils.getImageUrl(token), fileDownloadUtils.getImageResizedUrl(token,
+ ImageSize.sized));
+ } else if (mimeType.toString().equals("text/plain") || mimeType.toString().equals("application/pdf")) {
+ view.setContent(text);
+ } else {
+ view.setContent("");
+ }
+ }
+ } else {
+ view.setContent(text);
+ }
+ }
+}
Property changes on: trunk/src/main/java/org/ourproject/kune/docs/client/cnt/reader/DocumentViewerPresenter.java
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: trunk/src/main/java/org/ourproject/kune/docs/client/cnt/reader/DocumentViewerView.java (from rev 934, trunk/src/main/java/org/ourproject/kune/docs/client/cnt/reader/DocumentReaderView.java)
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/cnt/reader/DocumentReaderView.java 2008-10-28 15:40:27 UTC (rev 934)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/cnt/reader/DocumentViewerView.java 2008-11-04 15:07:14 UTC (rev 939)
@@ -0,0 +1,30 @@
+/*
+ *
+ * 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.reader;
+
+import org.ourproject.kune.platf.client.View;
+
+public interface DocumentViewerView extends View {
+
+ void setContent(String content);
+
+ void showImage(String imageUrl, String imageResizedUrl);
+
+}
Property changes on: trunk/src/main/java/org/ourproject/kune/docs/client/cnt/reader/DocumentViewerView.java
___________________________________________________________________
Name: svn:mergeinfo
+
Modified: trunk/src/main/java/org/ourproject/kune/docs/client/ctx/DocumentContextPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/ctx/DocumentContextPresenter.java 2008-11-04 12:32:31 UTC (rev 938)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/ctx/DocumentContextPresenter.java 2008-11-04 15:07:14 UTC (rev 939)
@@ -20,7 +20,7 @@
package org.ourproject.kune.docs.client.ctx;
import org.ourproject.kune.docs.client.DocumentClientTool;
-import org.ourproject.kune.docs.client.ctx.admin.AdminContext;
+import org.ourproject.kune.docs.client.ctx.admin.DocContextEditor;
import org.ourproject.kune.platf.client.dto.StateAbstractDTO;
import org.ourproject.kune.platf.client.dto.StateContainerDTO;
import org.ourproject.kune.platf.client.dto.StateContentDTO;
@@ -32,10 +32,10 @@
public class DocumentContextPresenter implements DocumentContext {
private final Provider<ContextNavigator> contextNavigatorProvider;
- private final Provider<AdminContext> adminContextProvider;
+ private final Provider<DocContextEditor> adminContextProvider;
public DocumentContextPresenter(final StateManager stateManager,
- final Provider<ContextNavigator> contextNavigatorProvider, final Provider<AdminContext> adminContextProvider) {
+ final Provider<ContextNavigator> contextNavigatorProvider, final Provider<DocContextEditor> adminContextProvider) {
this.contextNavigatorProvider = contextNavigatorProvider;
this.adminContextProvider = adminContextProvider;
stateManager.onStateChanged(new Listener<StateAbstractDTO>() {
Deleted: trunk/src/main/java/org/ourproject/kune/docs/client/ctx/admin/AdminContext.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/ctx/admin/AdminContext.java 2008-11-04 12:32:31 UTC (rev 938)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/ctx/admin/AdminContext.java 2008-11-04 15:07:14 UTC (rev 939)
@@ -1,32 +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.ctx.admin;
-
-import org.ourproject.kune.platf.client.dto.StateContentDTO;
-
-public interface AdminContext {
- void attach();
-
- void clear();
-
- void detach();
-
- void setState(StateContentDTO content);
-}
Deleted: trunk/src/main/java/org/ourproject/kune/docs/client/ctx/admin/AdminContextPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/ctx/admin/AdminContextPanel.java 2008-11-04 12:32:31 UTC (rev 938)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/ctx/admin/AdminContextPanel.java 2008-11-04 15:07:14 UTC (rev 939)
@@ -1,277 +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.ctx.admin;
-
-import java.util.Date;
-import java.util.List;
-
-import org.ourproject.kune.platf.client.dto.AccessListsDTO;
-import org.ourproject.kune.platf.client.dto.I18nLanguageDTO;
-import org.ourproject.kune.platf.client.dto.UserSimpleDTO;
-import org.ourproject.kune.platf.client.services.I18nTranslationService;
-import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton;
-
-import com.google.gwt.user.client.ui.Label;
-import com.google.gwt.user.client.ui.VerticalPanel;
-
-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 WorkspaceSkeleton ws;
- private final Label testLabel;
-
- public AdminContextPanel(final AdminContextPresenter presenter, final I18nTranslationService i18n,
- WorkspaceSkeleton ws) {
- this.ws = ws;
- testLabel = new Label("Admin ctx");
- // 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 attach() {
- if (!testLabel.isAttached()) {
- ws.getEntityWorkspace().setContext(testLabel);
- }
- }
-
- public void detach() {
- if (testLabel.isAttached()) {
- testLabel.removeFromParent();
- }
- }
-
- public void removeAccessListComponent() {
- // if (options.containsItem(perms_item)) {
- // removeComponent(perms_item);
- // }
- }
-
- public void removeAuthorsComponent() {
- // if (options.containsItem(authors_item)) {
- // removeComponent(authors_item);
- // }
- }
-
- public void removeLangComponent() {
- // if (options.containsItem(language_item)) {
- // removeComponent(language_item);
- // }
- }
-
- public void removePublishedOnComponent() {
- // if (options.containsItem(publication_item)) {
- // removeComponent(publication_item);
- // }
- }
-
- public void removeTagsComponent() {
- // if (options.containsItem(tags_item)) {
- // removeComponent(tags_item);
- // }
- }
-
- public void reset() {
- // 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);
- }
-
- 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);
- }
-
- 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);
- }
-
- 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);
- }
-
- 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);
- // }
- //
- // 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%");
- }
-
- // private FormPanel createDefaultForm() {
- // final FormPanel form = new FormPanel();
- // form.setHideLabels(true);
- // form.setWidth(FORMS_WIDTH);
- // form.setBorder(false);
- // return form;
- // }
-
- // 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;
- // }
-
- // private void removeComponent(final String header) {
- // options.removeStackItem(header);
- // }
-
-}
Deleted: 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-11-04 12:32:31 UTC (rev 938)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/ctx/admin/AdminContextPresenter.java 2008-11-04 15:07:14 UTC (rev 939)
@@ -1,176 +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.ctx.admin;
-
-import java.util.Date;
-import java.util.List;
-
-import org.ourproject.kune.platf.client.dto.AccessListsDTO;
-import org.ourproject.kune.platf.client.dto.I18nLanguageDTO;
-import org.ourproject.kune.platf.client.dto.StateContainerDTO;
-import org.ourproject.kune.platf.client.dto.StateContentDTO;
-import org.ourproject.kune.platf.client.dto.TagResultDTO;
-import org.ourproject.kune.platf.client.dto.UserSimpleDTO;
-import org.ourproject.kune.platf.client.rpc.AsyncCallbackSimple;
-import org.ourproject.kune.platf.client.rpc.ContentServiceAsync;
-import org.ourproject.kune.platf.client.state.Session;
-import org.ourproject.kune.platf.client.state.StateManager;
-import org.ourproject.kune.workspace.client.site.Site;
-import org.ourproject.kune.workspace.client.tags.TagsSummary;
-import org.ourproject.kune.workspace.client.title.EntitySubTitle;
-import org.ourproject.kune.workspace.client.title.EntityTitle;
-
-import com.calclab.suco.client.ioc.Provider;
-
-public class AdminContextPresenter implements AdminContext {
-
- private AdminContextView view;
- private final Session session;
- private final Provider<TagsSummary> tagsSummaryProvider;
- private final Provider<ContentServiceAsync> contentServiceProvider;
- private final EntitySubTitle entitySubTitle;
- private final EntityTitle entityTitle;
- private final StateManager stateManager;
-
- public AdminContextPresenter(final Session session, final StateManager stateManager,
- final Provider<TagsSummary> tagsSummaryProvider,
- final Provider<ContentServiceAsync> contentServiceProvider, final EntityTitle entityTitle,
- final EntitySubTitle entitySubTitle) {
- this.session = session;
- this.stateManager = stateManager;
- this.tagsSummaryProvider = tagsSummaryProvider;
- this.contentServiceProvider = contentServiceProvider;
- this.entityTitle = entityTitle;
- this.entitySubTitle = entitySubTitle;
- }
-
- public void addAuthor(final String authorShortName) {
- Site.showProgressProcessing();
- final StateContainerDTO currentState = session.getContentState();
- contentServiceProvider.get().addAuthor(session.getUserHash(), currentState.getStateToken(), authorShortName,
- new AsyncCallbackSimple<Object>() {
- public void onSuccess(final Object result) {
- Site.hideProgress();
- stateManager.reload();
- }
- });
- }
-
- public void attach() {
- view.attach();
- }
-
- public void clear() {
- view.reset();
- }
-
- public void delAuthor(final String authorShortName) {
- Site.showProgressProcessing();
- final StateContainerDTO currentState = session.getContentState();
- contentServiceProvider.get().removeAuthor(session.getUserHash(), currentState.getStateToken(), authorShortName,
- new AsyncCallbackSimple<Object>() {
- public void onSuccess(final Object result) {
- Site.hideProgress();
- stateManager.reload();
- }
- });
- }
-
- public void detach() {
- view.detach();
- }
-
- public void doChangeLanguage(final String langCode) {
- Site.showProgressProcessing();
- final StateContainerDTO currentState = session.getContentState();
- contentServiceProvider.get().setLanguage(session.getUserHash(), currentState.getStateToken(), langCode,
- new AsyncCallbackSimple<I18nLanguageDTO>() {
- public void onSuccess(final I18nLanguageDTO lang) {
- Site.hideProgress();
- entitySubTitle.setContentLanguage(lang.getEnglishName());
- }
- });
- }
-
- public void init(final AdminContextView view) {
- this.view = view;
- }
-
- public void setPublishedOn(final Date publishedOn) {
- Site.showProgressProcessing();
- final StateContainerDTO currentState = session.getContentState();
- contentServiceProvider.get().setPublishedOn(session.getUserHash(), currentState.getStateToken(), publishedOn,
- new AsyncCallbackSimple<Object>() {
- public void onSuccess(final Object result) {
- Site.hideProgress();
- entityTitle.setContentDate(publishedOn);
- }
- });
-
- }
-
- public void setState(final StateContentDTO content) {
- // In the future check the use of these components by each tool
- final I18nLanguageDTO language = content.getLanguage();
- final AccessListsDTO accessLists = content.getAccessLists();
- final Date publishedOn = content.getPublishedOn();
- final String tags = content.getTags();
- final List<UserSimpleDTO> authors = content.getAuthors();
-
- if (tags != null) {
- view.setTags(tags);
- } else {
- view.removeTagsComponent();
- }
- if (language != null) {
- view.setLanguage(language);
- } else {
- view.removeLangComponent();
- }
- if (authors != null) {
- view.setAuthors(authors);
- } else {
- view.removeAuthorsComponent();
- }
- if (publishedOn != null) {
- view.setPublishedOn(publishedOn);
- } else {
- view.removePublishedOnComponent();
- }
- if (accessLists != null) {
- view.setAccessLists(accessLists);
- } else {
- view.removeAccessListComponent();
- }
- }
-
- public void setTags(final String tagsString) {
- Site.showProgressProcessing();
- final StateContainerDTO currentState = session.getContentState();
- contentServiceProvider.get().setTags(session.getUserHash(), currentState.getStateToken(), tagsString,
- new AsyncCallbackSimple<List<TagResultDTO>>() {
- public void onSuccess(final List<TagResultDTO> result) {
- tagsSummaryProvider.get().setGroupTags(result);
- Site.hideProgress();
- }
- });
- }
-
-}
Deleted: trunk/src/main/java/org/ourproject/kune/docs/client/ctx/admin/AdminContextView.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/ctx/admin/AdminContextView.java 2008-11-04 12:32:31 UTC (rev 938)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/ctx/admin/AdminContextView.java 2008-11-04 15:07:14 UTC (rev 939)
@@ -1,58 +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.ctx.admin;
-
-import java.util.Date;
-import java.util.List;
-
-import org.ourproject.kune.platf.client.View;
-import org.ourproject.kune.platf.client.dto.AccessListsDTO;
-import org.ourproject.kune.platf.client.dto.I18nLanguageDTO;
-import org.ourproject.kune.platf.client.dto.UserSimpleDTO;
-
-public interface AdminContextView extends View {
-
- void attach();
-
- void detach();
-
- void removeAccessListComponent();
-
- void removeAuthorsComponent();
-
- void removeLangComponent();
-
- void removePublishedOnComponent();
-
- void removeTagsComponent();
-
- void reset();
-
- void setAccessLists(AccessListsDTO accessLists);
-
- void setAuthors(List<UserSimpleDTO> authors);
-
- void setLanguage(I18nLanguageDTO language);
-
- void setPublishedOn(Date publishedOn);
-
- void setTags(String tags);
-
-}
Copied: trunk/src/main/java/org/ourproject/kune/docs/client/ctx/admin/DocContextEditor.java (from rev 937, trunk/src/main/java/org/ourproject/kune/docs/client/ctx/admin/AdminContext.java)
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/ctx/admin/AdminContext.java 2008-10-30 17:13:18 UTC (rev 937)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/ctx/admin/DocContextEditor.java 2008-11-04 15:07:14 UTC (rev 939)
@@ -0,0 +1,32 @@
+/*
+ *
+ * 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.ctx.admin;
+
+import org.ourproject.kune.platf.client.dto.StateContentDTO;
+
+public interface DocContextEditor {
+ void attach();
+
+ void clear();
+
+ void detach();
+
+ void setState(StateContentDTO content);
+}
Property changes on: trunk/src/main/java/org/ourproject/kune/docs/client/ctx/admin/DocContextEditor.java
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: trunk/src/main/java/org/ourproject/kune/docs/client/ctx/admin/DocContextEditorPanel.java (from rev 937, trunk/src/main/java/org/ourproject/kune/docs/client/ctx/admin/AdminContextPanel.java)
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/ctx/admin/AdminContextPanel.java 2008-10-30 17:13:18 UTC (rev 937)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/ctx/admin/DocContextEditorPanel.java 2008-11-04 15:07:14 UTC (rev 939)
@@ -0,0 +1,277 @@
+/*
+ *
+ * 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.ctx.admin;
+
+import java.util.Date;
+import java.util.List;
+
+import org.ourproject.kune.platf.client.dto.AccessListsDTO;
+import org.ourproject.kune.platf.client.dto.I18nLanguageDTO;
+import org.ourproject.kune.platf.client.dto.UserSimpleDTO;
+import org.ourproject.kune.platf.client.services.I18nTranslationService;
+import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton;
+
+import com.google.gwt.user.client.ui.Label;
+import com.google.gwt.user.client.ui.VerticalPanel;
+
+public class DocContextEditorPanel extends VerticalPanel implements DocContextEditorView {
+ // 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 WorkspaceSkeleton ws;
+ private final Label testLabel;
+
+ public DocContextEditorPanel(final DocContextEditorPresenter presenter, final I18nTranslationService i18n,
+ WorkspaceSkeleton ws) {
+ this.ws = ws;
+ testLabel = new Label("Admin ctx");
+ // 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 attach() {
+ if (!testLabel.isAttached()) {
+ ws.getEntityWorkspace().setContext(testLabel);
+ }
+ }
+
+ public void detach() {
+ if (testLabel.isAttached()) {
+ testLabel.removeFromParent();
+ }
+ }
+
+ public void removeAccessListComponent() {
+ // if (options.containsItem(perms_item)) {
+ // removeComponent(perms_item);
+ // }
+ }
+
+ public void removeAuthorsComponent() {
+ // if (options.containsItem(authors_item)) {
+ // removeComponent(authors_item);
+ // }
+ }
+
+ public void removeLangComponent() {
+ // if (options.containsItem(language_item)) {
+ // removeComponent(language_item);
+ // }
+ }
+
+ public void removePublishedOnComponent() {
+ // if (options.containsItem(publication_item)) {
+ // removeComponent(publication_item);
+ // }
+ }
+
+ public void removeTagsComponent() {
+ // if (options.containsItem(tags_item)) {
+ // removeComponent(tags_item);
+ // }
+ }
+
+ public void reset() {
+ // 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);
+ }
+
+ 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);
+ }
+
+ 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);
+ }
+
+ 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);
+ }
+
+ 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);
+ // }
+ //
+ // 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%");
+ }
+
+ // private FormPanel createDefaultForm() {
+ // final FormPanel form = new FormPanel();
+ // form.setHideLabels(true);
+ // form.setWidth(FORMS_WIDTH);
+ // form.setBorder(false);
+ // return form;
+ // }
+
+ // 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;
+ // }
+
+ // private void removeComponent(final String header) {
+ // options.removeStackItem(header);
+ // }
+
+}
Copied: trunk/src/main/java/org/ourproject/kune/docs/client/ctx/admin/DocContextEditorPresenter.java (from rev 937, 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-10-30 17:13:18 UTC (rev 937)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/ctx/admin/DocContextEditorPresenter.java 2008-11-04 15:07:14 UTC (rev 939)
@@ -0,0 +1,176 @@
+/*
+ *
+ * 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.ctx.admin;
+
+import java.util.Date;
+import java.util.List;
+
+import org.ourproject.kune.platf.client.dto.AccessListsDTO;
+import org.ourproject.kune.platf.client.dto.I18nLanguageDTO;
+import org.ourproject.kune.platf.client.dto.StateContainerDTO;
+import org.ourproject.kune.platf.client.dto.StateContentDTO;
+import org.ourproject.kune.platf.client.dto.TagResultDTO;
+import org.ourproject.kune.platf.client.dto.UserSimpleDTO;
+import org.ourproject.kune.platf.client.rpc.AsyncCallbackSimple;
+import org.ourproject.kune.platf.client.rpc.ContentServiceAsync;
+import org.ourproject.kune.platf.client.state.Session;
+import org.ourproject.kune.platf.client.state.StateManager;
+import org.ourproject.kune.workspace.client.site.Site;
+import org.ourproject.kune.workspace.client.tags.TagsSummary;
+import org.ourproject.kune.workspace.client.title.EntitySubTitle;
+import org.ourproject.kune.workspace.client.title.EntityTitle;
+
+import com.calclab.suco.client.ioc.Provider;
+
+public class DocContextEditorPresenter implements DocContextEditor {
+
+ private DocContextEditorView view;
+ private final Session session;
+ private final Provider<TagsSummary> tagsSummaryProvider;
+ private final Provider<ContentServiceAsync> contentServiceProvider;
+ private final EntitySubTitle entitySubTitle;
+ private final EntityTitle entityTitle;
+ private final StateManager stateManager;
+
+ public DocContextEditorPresenter(final Session session, final StateManager stateManager,
+ final Provider<TagsSummary> tagsSummaryProvider,
+ final Provider<ContentServiceAsync> contentServiceProvider, final EntityTitle entityTitle,
+ final EntitySubTitle entitySubTitle) {
+ this.session = session;
+ this.stateManager = stateManager;
+ this.tagsSummaryProvider = tagsSummaryProvider;
+ this.contentServiceProvider = contentServiceProvider;
+ this.entityTitle = entityTitle;
+ this.entitySubTitle = entitySubTitle;
+ }
+
+ public void addAuthor(final String authorShortName) {
+ Site.showProgressProcessing();
+ final StateContainerDTO currentState = session.getContentState();
+ contentServiceProvider.get().addAuthor(session.getUserHash(), currentState.getStateToken(), authorShortName,
+ new AsyncCallbackSimple<Object>() {
+ public void onSuccess(final Object result) {
+ Site.hideProgress();
+ stateManager.reload();
+ }
+ });
+ }
+
+ public void attach() {
+ view.attach();
+ }
+
+ public void clear() {
+ view.reset();
+ }
+
+ public void delAuthor(final String authorShortName) {
+ Site.showProgressProcessing();
+ final StateContainerDTO currentState = session.getContentState();
+ contentServiceProvider.get().removeAuthor(session.getUserHash(), currentState.getStateToken(), authorShortName,
+ new AsyncCallbackSimple<Object>() {
+ public void onSuccess(final Object result) {
+ Site.hideProgress();
+ stateManager.reload();
+ }
+ });
+ }
+
+ public void detach() {
+ view.detach();
+ }
+
+ public void doChangeLanguage(final String langCode) {
+ Site.showProgressProcessing();
+ final StateContainerDTO currentState = session.getContentState();
+ contentServiceProvider.get().setLanguage(session.getUserHash(), currentState.getStateToken(), langCode,
+ new AsyncCallbackSimple<I18nLanguageDTO>() {
+ public void onSuccess(final I18nLanguageDTO lang) {
+ Site.hideProgress();
+ entitySubTitle.setContentLanguage(lang.getEnglishName());
+ }
+ });
+ }
+
+ public void init(final DocContextEditorView view) {
+ this.view = view;
+ }
+
+ public void setPublishedOn(final Date publishedOn) {
+ Site.showProgressProcessing();
+ final StateContainerDTO currentState = session.getContentState();
+ contentServiceProvider.get().setPublishedOn(session.getUserHash(), currentState.getStateToken(), publishedOn,
+ new AsyncCallbackSimple<Object>() {
+ public void onSuccess(final Object result) {
+ Site.hideProgress();
+ entityTitle.setContentDate(publishedOn);
+ }
+ });
+
+ }
+
+ public void setState(final StateContentDTO content) {
+ // In the future check the use of these components by each tool
+ final I18nLanguageDTO language = content.getLanguage();
+ final AccessListsDTO accessLists = content.getAccessLists();
+ final Date publishedOn = content.getPublishedOn();
+ final String tags = content.getTags();
+ final List<UserSimpleDTO> authors = content.getAuthors();
+
+ if (tags != null) {
+ view.setTags(tags);
+ } else {
+ view.removeTagsComponent();
+ }
+ if (language != null) {
+ view.setLanguage(language);
+ } else {
+ view.removeLangComponent();
+ }
+ if (authors != null) {
+ view.setAuthors(authors);
+ } else {
+ view.removeAuthorsComponent();
+ }
+ if (publishedOn != null) {
+ view.setPublishedOn(publishedOn);
+ } else {
+ view.removePublishedOnComponent();
+ }
+ if (accessLists != null) {
+ view.setAccessLists(accessLists);
+ } else {
+ view.removeAccessListComponent();
+ }
+ }
+
+ public void setTags(final String tagsString) {
+ Site.showProgressProcessing();
+ final StateContainerDTO currentState = session.getContentState();
+ contentServiceProvider.get().setTags(session.getUserHash(), currentState.getStateToken(), tagsString,
+ new AsyncCallbackSimple<List<TagResultDTO>>() {
+ public void onSuccess(final List<TagResultDTO> result) {
+ tagsSummaryProvider.get().setGroupTags(result);
+ Site.hideProgress();
+ }
+ });
+ }
+
+}
Property changes on: trunk/src/main/java/org/ourproject/kune/docs/client/ctx/admin/DocContextEditorPresenter.java
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: trunk/src/main/java/org/ourproject/kune/docs/client/ctx/admin/DocContextEditorView.java (from rev 937, trunk/src/main/java/org/ourproject/kune/docs/client/ctx/admin/AdminContextView.java)
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/ctx/admin/AdminContextView.java 2008-10-30 17:13:18 UTC (rev 937)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/ctx/admin/DocContextEditorView.java 2008-11-04 15:07:14 UTC (rev 939)
@@ -0,0 +1,58 @@
+/*
+ *
+ * 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.ctx.admin;
+
+import java.util.Date;
+import java.util.List;
+
+import org.ourproject.kune.platf.client.View;
+import org.ourproject.kune.platf.client.dto.AccessListsDTO;
+import org.ourproject.kune.platf.client.dto.I18nLanguageDTO;
+import org.ourproject.kune.platf.client.dto.UserSimpleDTO;
+
+public interface DocContextEditorView extends View {
+
+ void attach();
+
+ void detach();
+
+ void removeAccessListComponent();
+
+ void removeAuthorsComponent();
+
+ void removeLangComponent();
+
+ void removePublishedOnComponent();
+
+ void removeTagsComponent();
+
+ void reset();
+
+ void setAccessLists(AccessListsDTO accessLists);
+
+ void setAuthors(List<UserSimpleDTO> authors);
+
+ void setLanguage(I18nLanguageDTO language);
+
+ void setPublishedOn(Date publishedOn);
+
+ void setTags(String tags);
+
+}
Property changes on: trunk/src/main/java/org/ourproject/kune/docs/client/ctx/admin/DocContextEditorView.java
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: trunk/src/main/java/org/ourproject/kune/platf/client/state/BeforeActionListener.java (from rev 937, trunk/src/main/java/org/ourproject/kune/platf/client/state/BeforeStateChangeListener.java)
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/state/BeforeStateChangeListener.java 2008-10-30 17:13:18 UTC (rev 937)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/state/BeforeActionListener.java 2008-11-04 15:07:14 UTC (rev 939)
@@ -0,0 +1,7 @@
+package org.ourproject.kune.platf.client.state;
+
+public interface BeforeActionListener {
+
+ boolean beforeAction();
+
+}
Property changes on: trunk/src/main/java/org/ourproject/kune/platf/client/state/BeforeActionListener.java
___________________________________________________________________
Name: svn:mergeinfo
+
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/state/BeforeStateChangeCollection.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/state/BeforeStateChangeCollection.java 2008-11-04 12:32:31 UTC (rev 938)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/state/BeforeStateChangeCollection.java 2008-11-04 15:07:14 UTC (rev 939)
@@ -2,7 +2,7 @@
import java.util.ArrayList;
-public class BeforeStateChangeCollection extends ArrayList<BeforeStateChangeListener> {
+public class BeforeStateChangeCollection extends ArrayList<BeforeActionListener> {
private static final long serialVersionUID = 1L;
Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/state/BeforeStateChangeListener.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/state/BeforeStateChangeListener.java 2008-11-04 12:32:31 UTC (rev 938)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/state/BeforeStateChangeListener.java 2008-11-04 15:07:14 UTC (rev 939)
@@ -1,8 +0,0 @@
-package org.ourproject.kune.platf.client.state;
-
-
-public interface BeforeStateChangeListener {
-
- boolean beforeChange(String newToken);
-
-}
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-11-04 12:32:31 UTC (rev 938)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/state/StateManager.java 2008-11-04 15:07:14 UTC (rev 939)
@@ -29,7 +29,7 @@
public interface StateManager {
- void addBeforeStateChangeListener(BeforeStateChangeListener listener);
+ void addBeforeStateChangeListener(BeforeActionListener listener);
void addSiteToken(String token, Listener0 whenToken);
@@ -47,7 +47,7 @@
void reload();
- void removeBeforeStateChangeListener(BeforeStateChangeListener listener);
+ void removeBeforeStateChangeListener(BeforeActionListener listener);
void removeSiteToken(String token);
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-04 12:32:31 UTC (rev 938)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/state/StateManagerDefault.java 2008-11-04 15:07:14 UTC (rev 939)
@@ -87,7 +87,7 @@
beforeStateChangeCollection = new BeforeStateChangeCollection();
}
- public void addBeforeStateChangeListener(BeforeStateChangeListener listener) {
+ public void addBeforeStateChangeListener(BeforeActionListener listener) {
beforeStateChangeCollection.add(listener);
}
@@ -109,7 +109,7 @@
}
public void onHistoryChanged(final String historyToken) {
- if (beforeStateListenersAllowChange(historyToken)) {
+ if (beforeStateListenersAllowChange()) {
final Listener0 tokenListener = siteTokens.get(historyToken);
Log.debug("StateManager: history token changed (" + historyToken + ")");
if (tokenListener == null) {
@@ -125,7 +125,7 @@
tokenListener.onEvent();
}
} else {
- resumedToken = previousToken;
+ resumedToken = new StateToken(historyToken);
}
}
@@ -150,7 +150,7 @@
onHistoryChanged(history.getToken());
}
- public void removeBeforeStateChangeListener(BeforeStateChangeListener listener) {
+ public void removeBeforeStateChangeListener(BeforeActionListener listener) {
beforeStateChangeCollection.remove(listener);
}
@@ -199,9 +199,9 @@
previousToken = newState.getStateToken();
}
- private boolean beforeStateListenersAllowChange(String newToken) {
- for (BeforeStateChangeListener listener : beforeStateChangeCollection) {
- if (!listener.beforeChange(newToken)) {
+ private boolean beforeStateListenersAllowChange() {
+ for (BeforeActionListener listener : beforeStateChangeCollection) {
+ if (!listener.beforeAction()) {
return false;
}
}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/editor/TextEditorPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/editor/TextEditorPresenter.java 2008-11-04 12:32:31 UTC (rev 938)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/editor/TextEditorPresenter.java 2008-11-04 15:07:14 UTC (rev 939)
@@ -27,7 +27,7 @@
import org.ourproject.kune.platf.client.actions.toolbar.ActionToolbar;
import org.ourproject.kune.platf.client.dto.AccessRolDTO;
import org.ourproject.kune.platf.client.dto.StateToken;
-import org.ourproject.kune.platf.client.state.BeforeStateChangeListener;
+import org.ourproject.kune.platf.client.state.BeforeActionListener;
import org.ourproject.kune.platf.client.state.StateManager;
import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService;
@@ -50,7 +50,7 @@
private ActionToolbarButtonDescriptor<StateToken> save;
private ActionToolbarButtonDescriptor<StateToken> close;
private final I18nUITranslationService i18n;
- private final BeforeStateChangeListener beforeStateChangeListener;
+ private final BeforeActionListener beforeStateChangeListener;
private final StateManager stateManager;
public TextEditorPresenter(final boolean isAutoSave, final ActionToolbar<StateToken> toolbar,
@@ -64,8 +64,8 @@
saveAndCloseConfirmed = false;
createActions();
- beforeStateChangeListener = new BeforeStateChangeListener() {
- public boolean beforeChange(String newToken) {
+ beforeStateChangeListener = new BeforeActionListener() {
+ public boolean beforeAction() {
return beforeTokenChange();
}
};
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-11-04 12:32:31 UTC (rev 938)
+++ trunk/src/test/java/org/ourproject/kune/platf/client/state/StateManagerTest.java 2008-11-04 15:07:14 UTC (rev 939)
@@ -29,8 +29,8 @@
private MockListener2<String, String> groupChangeListener;
private MockListener<StateAbstractDTO> stateChangeListener;
private StateAbstractDTO state;
- private BeforeStateChangeListener beforeChangeListener1;
- private BeforeStateChangeListener beforeChangeListener2;
+ private BeforeActionListener beforeChangeListener1;
+ private BeforeActionListener beforeChangeListener2;
@Before
public void before() {
@@ -43,8 +43,8 @@
stateChangeListener = new MockListener<StateAbstractDTO>();
groupChangeListener = new MockListener2<String, String>();
toolChangeListener = new MockListener2<String, String>();
- beforeChangeListener1 = Mockito.mock(BeforeStateChangeListener.class);
- beforeChangeListener2 = Mockito.mock(BeforeStateChangeListener.class);
+ beforeChangeListener1 = Mockito.mock(BeforeActionListener.class);
+ beforeChangeListener2 = Mockito.mock(BeforeActionListener.class);
stateManager.onStateChanged(stateChangeListener);
stateManager.onGroupChanged(groupChangeListener);
stateManager.onToolChanged(toolChangeListener);
@@ -197,8 +197,8 @@
stateManager.addBeforeStateChangeListener(beforeChangeListener1);
stateManager.addBeforeStateChangeListener(beforeChangeListener2);
String newToken = "something";
- Mockito.stub(beforeChangeListener1.beforeChange(newToken)).toReturn(value);
- Mockito.stub(beforeChangeListener2.beforeChange(newToken)).toReturn(value2);
+ Mockito.stub(beforeChangeListener1.beforeAction()).toReturn(value);
+ Mockito.stub(beforeChangeListener2.beforeAction()).toReturn(value2);
return newToken;
}
Modified: trunk/src/test/java/org/ourproject/kune/platf/integration/selenium/KuneSeleniumTestHelper.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/integration/selenium/KuneSeleniumTestHelper.java 2008-11-04 12:32:31 UTC (rev 938)
+++ trunk/src/test/java/org/ourproject/kune/platf/integration/selenium/KuneSeleniumTestHelper.java 2008-11-04 15:07:14 UTC (rev 939)
@@ -44,7 +44,7 @@
@Before
public void before() {
- mustCapture = false;
+ mustCapture = true;
try {
selenium.deleteAllVisibleCookies();
selenium.refresh();
1
0
Author: vjrj
Date: 2008-11-04 13:32:31 +0100 (Tue, 04 Nov 2008)
New Revision: 938
Modified:
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/tool/ToolSelectorPresenter.java
trunk/src/main/java/org/ourproject/kune/workspace/client/editor/TextEditorPanel.java
trunk/src/main/java/org/ourproject/kune/workspace/client/editor/TextEditorPresenter.java
trunk/src/main/java/org/ourproject/kune/workspace/client/entitylogo/EntityLogoPresenter.java
trunk/src/main/java/org/ourproject/kune/workspace/client/newgroup/NewGroup.java
trunk/src/main/java/org/ourproject/kune/workspace/client/newgroup/NewGroupPresenter.java
trunk/src/main/java/org/ourproject/kune/workspace/client/signin/Register.java
trunk/src/main/java/org/ourproject/kune/workspace/client/signin/RegisterPanel.java
trunk/src/main/java/org/ourproject/kune/workspace/client/signin/RegisterPresenter.java
trunk/src/main/java/org/ourproject/kune/workspace/client/signin/SignIn.java
trunk/src/main/java/org/ourproject/kune/workspace/client/signin/SignInAbstractPresenter.java
trunk/src/main/java/org/ourproject/kune/workspace/client/signin/SignInPresenter.java
trunk/src/test/java/org/ourproject/kune/platf/client/state/StateManagerTest.java
trunk/src/test/java/org/ourproject/kune/platf/client/tool/ToolSelectorPresenterTest.java
trunk/src/test/java/org/ourproject/kune/workspace/client/editor/TextEditorPresenterTest.java
Log:
Complete - task TextEditor intercepts token change and ask for save before closing the editor
Complete - task StateManager refactor
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-10-30 17:13:18 UTC (rev 937)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneModule.java 2008-11-04 12:32:31 UTC (rev 938)
@@ -109,7 +109,6 @@
import com.calclab.suco.client.ioc.decorator.Singleton;
import com.calclab.suco.client.ioc.module.AbstractModule;
import com.calclab.suco.client.ioc.module.Factory;
-import com.calclab.suco.client.listener.Listener;
import com.calclab.suco.client.listener.Listener0;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.Cookies;
@@ -443,26 +442,26 @@
});
// Register of tokens like "signin", "newgroup", "translate" etcetera
- $(StateManager.class).addSiteToken(SiteToken.signin.toString(), new Listener<StateToken>() {
- public void onEvent(final StateToken previousStateToken) {
- $(SignIn.class).doSignIn(previousStateToken);
+ $(StateManager.class).addSiteToken(SiteToken.signin.toString(), new Listener0() {
+ public void onEvent() {
+ $(SignIn.class).doSignIn();
}
});
- $(StateManager.class).addSiteToken(SiteToken.register.toString(), new Listener<StateToken>() {
- public void onEvent(final StateToken previousStateToken) {
- $(Register.class).doRegister(previousStateToken);
+ $(StateManager.class).addSiteToken(SiteToken.register.toString(), new Listener0() {
+ public void onEvent() {
+ $(Register.class).doRegister();
}
});
- $(StateManager.class).addSiteToken(SiteToken.newgroup.toString(), new Listener<StateToken>() {
- public void onEvent(final StateToken previousStateToken) {
- $(NewGroup.class).doNewGroup(previousStateToken);
+ $(StateManager.class).addSiteToken(SiteToken.newgroup.toString(), new Listener0() {
+ public void onEvent() {
+ $(NewGroup.class).doNewGroup();
}
});
- $(StateManager.class).addSiteToken(SiteToken.translate.toString(), new Listener<StateToken>() {
- public void onEvent(final StateToken previousStateToken) {
+ $(StateManager.class).addSiteToken(SiteToken.translate.toString(), new Listener0() {
+ public void onEvent() {
$(I18nTranslator.class).doShowTranslator();
}
});
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-10-30 17:13:18 UTC (rev 937)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/state/StateManager.java 2008-11-04 12:32:31 UTC (rev 938)
@@ -19,26 +19,25 @@
*/
package org.ourproject.kune.platf.client.state;
-import org.ourproject.kune.platf.client.dto.GroupDTO;
import org.ourproject.kune.platf.client.dto.SocialNetworkResultDTO;
import org.ourproject.kune.platf.client.dto.StateAbstractDTO;
import org.ourproject.kune.platf.client.dto.StateToken;
import com.calclab.suco.client.listener.Listener;
+import com.calclab.suco.client.listener.Listener0;
import com.calclab.suco.client.listener.Listener2;
-import com.google.gwt.user.client.HistoryListener;
-public interface StateManager extends HistoryListener {
+public interface StateManager {
void addBeforeStateChangeListener(BeforeStateChangeListener listener);
- void addSiteToken(String token, Listener<StateToken> whenToken);
+ void addSiteToken(String token, Listener0 whenToken);
void gotoToken(StateToken newToken);
void gotoToken(String newToken);
- void onGroupChanged(Listener2<GroupDTO, GroupDTO> listener);
+ void onGroupChanged(Listener2<String, String> listener);
void onSocialNetworkChanged(Listener<StateAbstractDTO> listener);
@@ -52,8 +51,10 @@
void removeSiteToken(String token);
- void restorePreviousState();
+ void restorePreviousToken();
+ void resumeTokenChange();
+
void setRetrievedState(StateAbstractDTO state);
void setSocialNetwork(SocialNetworkResultDTO socialNet);
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-10-30 17:13:18 UTC (rev 937)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/state/StateManagerDefault.java 2008-11-04 12:32:31 UTC (rev 938)
@@ -22,12 +22,10 @@
import java.util.HashMap;
import org.ourproject.kune.platf.client.app.HistoryWrapper;
-import org.ourproject.kune.platf.client.dto.GroupDTO;
import org.ourproject.kune.platf.client.dto.ParticipationDataDTO;
import org.ourproject.kune.platf.client.dto.SocialNetworkDTO;
import org.ourproject.kune.platf.client.dto.SocialNetworkResultDTO;
import org.ourproject.kune.platf.client.dto.StateAbstractDTO;
-import org.ourproject.kune.platf.client.dto.StateContainerDTO;
import org.ourproject.kune.platf.client.dto.StateToken;
import org.ourproject.kune.platf.client.dto.UserBuddiesDataDTO;
import org.ourproject.kune.platf.client.dto.UserInfoDTO;
@@ -40,17 +38,23 @@
import com.calclab.suco.client.listener.Listener;
import com.calclab.suco.client.listener.Listener0;
import com.calclab.suco.client.listener.Listener2;
+import com.google.gwt.user.client.HistoryListener;
-public class StateManagerDefault implements StateManager {
+public class StateManagerDefault implements StateManager, HistoryListener {
private final ContentProvider contentProvider;
- private StateAbstractDTO oldState;
+ private StateToken previousToken;
+ /**
+ * When a historyChanged is interrupted (for instance because you are
+ * editing something), the new token is stored here
+ */
+ private StateToken resumedToken;
private final Session session;
private final HistoryWrapper history;
- private final HashMap<String, Listener<StateToken>> siteTokens;
+ private final HashMap<String, Listener0> siteTokens;
private final Event<StateAbstractDTO> onStateChanged;
private final Event<StateAbstractDTO> onSocialNetworkChanged;
private final Event2<String, String> onToolChanged;
- private final Event2<GroupDTO, GroupDTO> onGroupChanged;
+ private final Event2<String, String> onGroupChanged;
private final BeforeStateChangeCollection beforeStateChangeCollection;
public StateManagerDefault(final ContentProvider contentProvider, final Session session,
@@ -58,17 +62,19 @@
this.contentProvider = contentProvider;
this.session = session;
this.history = history;
- this.oldState = null;
+ this.previousToken = null;
+ this.resumedToken = null;
this.onStateChanged = new Event<StateAbstractDTO>("onStateChanged");
- this.onGroupChanged = new Event2<GroupDTO, GroupDTO>("onGroupChanged");
+ this.onGroupChanged = new Event2<String, String>("onGroupChanged");
this.onToolChanged = new Event2<String, String>("onToolChanged");
this.onSocialNetworkChanged = new Event<StateAbstractDTO>("onSocialNetworkChanged");
session.onUserSignIn(new Listener<UserInfoDTO>() {
public void onEvent(final UserInfoDTO parameter) {
- if (oldState != null) {
- restorePreviousState();
+ if (previousToken == null) {
+ // starting up
+ reload();
} else {
- reload();
+ // do nothing, SigInPresent calls goto;
}
}
});
@@ -77,7 +83,7 @@
reload();
}
});
- siteTokens = new HashMap<String, Listener<StateToken>>();
+ siteTokens = new HashMap<String, Listener0>();
beforeStateChangeCollection = new BeforeStateChangeCollection();
}
@@ -85,13 +91,12 @@
beforeStateChangeCollection.add(listener);
}
- public void addSiteToken(final String token, final Listener<StateToken> listener) {
+ public void addSiteToken(final String token, final Listener0 listener) {
siteTokens.put(token, listener);
}
public void gotoToken(final StateToken newToken) {
Log.debug("StateManager: history goto-token newItem (" + newToken + ")");
-
history.newItem(newToken.getEncoded());
}
@@ -99,28 +104,28 @@
gotoToken(new StateToken(token));
}
- public void onGroupChanged(final Listener2<GroupDTO, GroupDTO> listener) {
+ public void onGroupChanged(final Listener2<String, String> listener) {
onGroupChanged.add(listener);
}
public void onHistoryChanged(final String historyToken) {
if (beforeStateListenersAllowChange(historyToken)) {
- final Listener<StateToken> tokenListener = siteTokens.get(historyToken);
+ final Listener0 tokenListener = siteTokens.get(historyToken);
Log.debug("StateManager: history token changed (" + historyToken + ")");
if (tokenListener == null) {
+ // Ok, normal token change
onHistoryChanged(new StateToken(historyToken));
} else {
- StateToken stateToken;
- if (oldState == null) {
+ // token is one of #newgroup #signin #translate ...
+ if (previousToken == null) {
// Starting with some token like "signin": load defContent
// also
- stateToken = new StateToken();
- onHistoryChanged(stateToken);
- } else {
- stateToken = oldState.getStateToken();
+ onHistoryChanged("");
}
- tokenListener.onEvent(stateToken);
+ tokenListener.onEvent();
}
+ } else {
+ resumedToken = previousToken;
}
}
@@ -153,13 +158,15 @@
siteTokens.remove(token);
}
- public void restorePreviousState() {
- if (oldState == null) {
- onHistoryChanged(new StateToken());
- } else {
- final StateAbstractDTO newState = oldState;
- oldState = session.getCurrentState();
- setState(newState);
+ public void restorePreviousToken() {
+ gotoToken(previousToken);
+ }
+
+ public void resumeTokenChange() {
+ if (resumedToken != null) {
+ reload();
+ gotoToken(resumedToken);
+ clearResumedToken();
}
}
@@ -184,6 +191,14 @@
}
}
+ void setState(final StateAbstractDTO newState) {
+ session.setCurrentState(newState);
+ onStateChanged.fire(newState);
+ Site.hideProgress();
+ checkGroupAndToolChange(newState);
+ previousToken = newState.getStateToken();
+ }
+
private boolean beforeStateListenersAllowChange(String newToken) {
for (BeforeStateChangeListener listener : beforeStateChangeCollection) {
if (!listener.beforeChange(newToken)) {
@@ -193,26 +208,26 @@
return true;
}
- private void checkGroupAndToolChange(final StateAbstractDTO oldState, final StateAbstractDTO newState) {
- final GroupDTO oldGroup = oldState != null ? oldState.getGroup() : null;
- final GroupDTO newGroup = newState.getGroup();
- if (oldState == null || !oldGroup.equals(newGroup)) {
- onGroupChanged.fire(oldGroup, newGroup);
+ 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);
}
- // TODO field with oldToolName
- String oldToolName = null;
- String newToolName = null;
- if (oldState instanceof StateContainerDTO) {
- oldToolName = oldState != null ? ((StateContainerDTO) oldState).getToolName() : null;
+ String previousTokenTool = previousToken == null ? "" : previousToken.getTool();
+ String newTokenTool = newState.getStateToken().getTool();
+ String previousToolName = previousTokenTool == null ? "" : previousTokenTool;
+ String newToolName = newTokenTool == null ? "" : newTokenTool;
+
+ if (previousToken == null || previousToolName == null || !previousToolName.equals(newToolName)) {
+ onToolChanged.fire(previousToolName, newToolName);
}
- if (newState instanceof StateContainerDTO) {
- newToolName = ((StateContainerDTO) newState).getToolName();
- }
- if (oldState == null || oldToolName == null || !oldToolName.equals(newToolName)) {
- onToolChanged.fire(oldToolName, newToolName);
- }
}
+ private void clearResumedToken() {
+ resumedToken = null;
+ }
+
private void onHistoryChanged(final StateToken newState) {
contentProvider.getContent(session.getUserHash(), newState, new AsyncCallbackSimple<StateAbstractDTO>() {
public void onSuccess(final StateAbstractDTO newState) {
@@ -220,12 +235,4 @@
}
});
}
-
- private void setState(final StateAbstractDTO newState) {
- session.setCurrentState(newState);
- onStateChanged.fire(newState);
- Site.hideProgress();
- checkGroupAndToolChange(oldState, newState);
- oldState = newState;
- }
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/tool/ToolSelectorPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/tool/ToolSelectorPresenter.java 2008-10-30 17:13:18 UTC (rev 937)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/tool/ToolSelectorPresenter.java 2008-11-04 12:32:31 UTC (rev 938)
@@ -21,7 +21,6 @@
import java.util.HashMap;
import java.util.List;
-import org.ourproject.kune.platf.client.dto.GroupDTO;
import org.ourproject.kune.platf.client.dto.StateAbstractDTO;
import org.ourproject.kune.platf.client.state.StateManager;
import org.ourproject.kune.workspace.client.themes.WsThemePresenter;
@@ -47,9 +46,9 @@
}
}
});
- stateManager.onGroupChanged(new Listener2<GroupDTO, GroupDTO>() {
- public void onEvent(final GroupDTO oldGroup, final GroupDTO newGroup) {
- onGroupChanged(newGroup.getShortName());
+ stateManager.onGroupChanged(new Listener2<String, String>() {
+ public void onEvent(final String oldGroup, final String newGroup) {
+ onGroupChanged(newGroup);
}
});
stateManager.onToolChanged(new Listener2<String, String>() {
@@ -78,10 +77,10 @@
}
void onToolChanged(final String oldTool, final String newTool) {
- if (oldTool != null) {
+ if (!oldTool.equals("")) {
tools.get(oldTool).setSelected(false);
}
- if (newTool != null) {
+ if (!newTool.equals("")) {
tools.get(newTool).setSelected(true);
}
}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/editor/TextEditorPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/editor/TextEditorPanel.java 2008-10-30 17:13:18 UTC (rev 937)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/editor/TextEditorPanel.java 2008-11-04 12:32:31 UTC (rev 938)
@@ -35,6 +35,7 @@
public class TextEditorPanel implements TextEditorView {
private static final String BACKCOLOR_ENABLED = "#FFF";
private static final String BACKCOLOR_DISABLED = "#CCC";
+ public static final String TEXT_AREA = "k-tep-ta";
private final RichTextArea gwtRTarea;
private final TextEditorToolbar textEditorToolbar;
private final TextEditorPresenter presenter;
@@ -54,6 +55,7 @@
gwtRTarea = new RichTextArea();
gwtRTarea.setWidth("97%");
gwtRTarea.addStyleName("kune-TexEditorPanel-TextArea");
+ gwtRTarea.ensureDebugId(TEXT_AREA);
final Toolbar editorTopBar = new Toolbar();
editorTopBar.getPanel().setWidth("auto");
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/editor/TextEditorPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/editor/TextEditorPresenter.java 2008-10-30 17:13:18 UTC (rev 937)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/editor/TextEditorPresenter.java 2008-11-04 12:32:31 UTC (rev 938)
@@ -51,7 +51,6 @@
private ActionToolbarButtonDescriptor<StateToken> close;
private final I18nUITranslationService i18n;
private final BeforeStateChangeListener beforeStateChangeListener;
- private String newTokenAfterSave;
private final StateManager stateManager;
public TextEditorPresenter(final boolean isAutoSave, final ActionToolbar<StateToken> toolbar,
@@ -67,7 +66,7 @@
beforeStateChangeListener = new BeforeStateChangeListener() {
public boolean beforeChange(String newToken) {
- return beforeTokenChange(newToken);
+ return beforeTokenChange();
}
};
}
@@ -79,7 +78,6 @@
view.attach();
setContent(content);
stateManager.addBeforeStateChangeListener(beforeStateChangeListener);
- newTokenAfterSave = null;
}
public String getContent() {
@@ -131,7 +129,6 @@
savePending = false;
saveAndCloseConfirmed = false;
toolbar.setEnableAction(save, false);
- newTokenAfterSave = null;
}
protected void onCancel() {
@@ -145,7 +142,7 @@
protected void onCancelConfirmed() {
stateManager.removeBeforeStateChangeListener(beforeStateChangeListener);
- gotoNewTokenIfNecessary();
+ stateManager.resumeTokenChange();
reset();
view.detach();
toolbar.detach();
@@ -172,9 +169,8 @@
onSave.onEvent(view.getHTML());
}
- boolean beforeTokenChange(String newToken) {
+ boolean beforeTokenChange() {
if (savePending) {
- newTokenAfterSave = newToken;
onCancel();
return false;
} else {
@@ -210,13 +206,6 @@
toolbar.setActions(collection);
}
- private void gotoNewTokenIfNecessary() {
- if (newTokenAfterSave != null) {
- stateManager.reload();
- stateManager.gotoToken(newTokenAfterSave);
- }
- }
-
private void setContent(final String html) {
this.view.setHTML(html);
}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/entitylogo/EntityLogoPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/entitylogo/EntityLogoPresenter.java 2008-10-30 17:13:18 UTC (rev 937)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/entitylogo/EntityLogoPresenter.java 2008-11-04 12:32:31 UTC (rev 938)
@@ -39,9 +39,9 @@
public EntityLogoPresenter(final StateManager stateManager, final WsThemePresenter theme, final Session session) {
this.session = session;
- stateManager.onGroupChanged(new Listener2<GroupDTO, GroupDTO>() {
- public void onEvent(final GroupDTO oldGroup, final GroupDTO newGroup) {
- setGroupLogo(newGroup);
+ stateManager.onGroupChanged(new Listener2<String, String>() {
+ public void onEvent(final String oldGroup, final String newGroup) {
+ setGroupLogo(session.getCurrentState().getGroup());
}
});
stateManager.onStateChanged(new Listener<StateAbstractDTO>() {
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/newgroup/NewGroup.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/newgroup/NewGroup.java 2008-10-30 17:13:18 UTC (rev 937)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/newgroup/NewGroup.java 2008-11-04 12:32:31 UTC (rev 938)
@@ -19,10 +19,9 @@
*/
package org.ourproject.kune.workspace.client.newgroup;
-import org.ourproject.kune.platf.client.dto.StateToken;
public interface NewGroup {
- void doNewGroup(StateToken previousToken);
+ void doNewGroup();
}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/newgroup/NewGroupPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/newgroup/NewGroupPresenter.java 2008-10-30 17:13:18 UTC (rev 937)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/newgroup/NewGroupPresenter.java 2008-11-04 12:32:31 UTC (rev 938)
@@ -34,7 +34,7 @@
import org.ourproject.kune.workspace.client.site.SiteToken;
import com.calclab.suco.client.ioc.Provider;
-import com.calclab.suco.client.listener.Listener;
+import com.calclab.suco.client.listener.Listener0;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.AsyncCallback;
@@ -43,7 +43,6 @@
public static final String REGISTER_TO_CREATE_A_GROUP = "Sign in or register to create a group";
private NewGroupView view;
private final I18nTranslationService i18n;
- private StateToken previousToken;
private final Session session;
private final StateManager stateManager;
private final Provider<GroupServiceAsync> groupServiceProvider;
@@ -54,15 +53,14 @@
this.session = session;
this.stateManager = stateManager;
this.groupServiceProvider = groupServiceProvider;
- stateManager.addSiteToken(SiteToken.newgroup.toString(), new Listener<StateToken>() {
- public void onEvent(final StateToken previousStateToken) {
- doNewGroup(previousStateToken);
+ stateManager.addSiteToken(SiteToken.newgroup.toString(), new Listener0() {
+ public void onEvent() {
+ doNewGroup();
}
});
}
- public void doNewGroup(final StateToken previousToken) {
- this.previousToken = previousToken;
+ public void doNewGroup() {
session.check(new AsyncCallbackSimple<Object>() {
public void onSuccess(final Object result) {
if (session.isLogged()) {
@@ -71,7 +69,7 @@
view.center();
Site.hideProgress();
} else {
- stateManager.gotoToken(previousToken);
+ stateManager.restorePreviousToken();
Site.info(i18n.t(REGISTER_TO_CREATE_A_GROUP));
}
}
@@ -96,12 +94,12 @@
public void onCancel() {
view.hide();
reset();
- stateManager.gotoToken(previousToken);
+ stateManager.restorePreviousToken();
}
public void onClose() {
reset();
- stateManager.gotoToken(previousToken);
+ stateManager.restorePreviousToken();
}
public void onFinish() {
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/signin/Register.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/signin/Register.java 2008-10-30 17:13:18 UTC (rev 937)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/signin/Register.java 2008-11-04 12:32:31 UTC (rev 938)
@@ -1,10 +1,9 @@
package org.ourproject.kune.workspace.client.signin;
-import org.ourproject.kune.platf.client.dto.StateToken;
public interface Register {
- void doRegister(StateToken previousStateToken);
+ void doRegister();
void hide();
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/signin/RegisterPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/signin/RegisterPanel.java 2008-10-30 17:13:18 UTC (rev 937)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/signin/RegisterPanel.java 2008-11-04 12:32:31 UTC (rev 938)
@@ -99,7 +99,8 @@
i18n.t("Now you can participate more actively in this site with other people and groups. "
+ "You can also use your personal space to publish contents. "
+ "Your email is not verified, please follow the instructions you will receive by email."),
- i18n.t("Ok"), WELCOME_OK_BUTTON, true, true, 400, 210);
+ i18n.t("Ok"), WELCOME_OK_BUTTON, true, true, 380, 210);
+ welcomeDialog.setId(WELCOME_DIALOG);
welcomeDialog.show();
}
@@ -107,7 +108,7 @@
InfoDialog welcomeDialog = new InfoDialog(i18n.t("Welcome"), i18n.t("Thanks for registering"),
i18n.t("Now you can participate more actively in this site with other people and groups. "
+ "Your email is not verified, please follow the instructions you will receive by email."),
- i18n.t("Ok"), WELCOME_OK_BUTTON, true, true, 400, 210);
+ i18n.t("Ok"), WELCOME_OK_BUTTON, true, true, 380, 210);
welcomeDialog.setId(WELCOME_DIALOG);
welcomeDialog.show();
}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/signin/RegisterPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/signin/RegisterPresenter.java 2008-10-30 17:13:18 UTC (rev 937)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/signin/RegisterPresenter.java 2008-11-04 12:32:31 UTC (rev 938)
@@ -3,7 +3,6 @@
import org.ourproject.kune.platf.client.View;
import org.ourproject.kune.platf.client.dto.I18nCountryDTO;
import org.ourproject.kune.platf.client.dto.I18nLanguageDTO;
-import org.ourproject.kune.platf.client.dto.StateToken;
import org.ourproject.kune.platf.client.dto.TimeZoneDTO;
import org.ourproject.kune.platf.client.dto.UserDTO;
import org.ourproject.kune.platf.client.dto.UserInfoDTO;
@@ -36,8 +35,7 @@
this.signInProvider = signInProvider;
}
- public void doRegister(StateToken previousStateToken) {
- this.previousStateToken = previousStateToken;
+ public void doRegister() {
signInProvider.get().hide();
if (!session.isLogged()) {
Site.showProgressProcessing();
@@ -45,7 +43,7 @@
view.center();
Site.hideProgress();
} else {
- stateManager.gotoToken(previousStateToken);
+ stateManager.restorePreviousToken();
}
}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/signin/SignIn.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/signin/SignIn.java 2008-10-30 17:13:18 UTC (rev 937)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/signin/SignIn.java 2008-11-04 12:32:31 UTC (rev 938)
@@ -1,10 +1,9 @@
package org.ourproject.kune.workspace.client.signin;
-import org.ourproject.kune.platf.client.dto.StateToken;
public interface SignIn {
- void doSignIn(StateToken previousStateToken);
+ void doSignIn();
void hide();
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/signin/SignInAbstractPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/signin/SignInAbstractPresenter.java 2008-10-30 17:13:18 UTC (rev 937)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/signin/SignInAbstractPresenter.java 2008-11-04 12:32:31 UTC (rev 938)
@@ -1,7 +1,6 @@
package org.ourproject.kune.workspace.client.signin;
import org.ourproject.kune.platf.client.dto.I18nLanguageDTO;
-import org.ourproject.kune.platf.client.dto.StateToken;
import org.ourproject.kune.platf.client.dto.UserInfoDTO;
import org.ourproject.kune.platf.client.state.Session;
import org.ourproject.kune.platf.client.state.StateManager;
@@ -12,7 +11,6 @@
protected final Session session;
protected final StateManager stateManager;
protected final I18nUITranslationService i18n;
- protected StateToken previousStateToken;
protected SignInAbstractView view;
public SignInAbstractPresenter(Session session, StateManager stateManager, I18nUITranslationService i18n) {
@@ -29,14 +27,14 @@
view.reset();
view.hideMessages();
view.hide();
- stateManager.gotoToken(previousStateToken);
+ stateManager.restorePreviousToken();
}
public void onClose() {
view.reset();
view.hideMessages();
if (!session.isLogged()) {
- stateManager.gotoToken(previousStateToken);
+ stateManager.restorePreviousToken();
}
}
@@ -49,6 +47,7 @@
final I18nLanguageDTO language = userInfoDTO.getLanguage();
i18n.changeCurrentLanguage(language.getCode());
session.setCurrentLanguage(language);
+ stateManager.restorePreviousToken();
}
}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/signin/SignInPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/signin/SignInPresenter.java 2008-10-30 17:13:18 UTC (rev 937)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/signin/SignInPresenter.java 2008-11-04 12:32:31 UTC (rev 938)
@@ -1,7 +1,6 @@
package org.ourproject.kune.workspace.client.signin;
import org.ourproject.kune.platf.client.View;
-import org.ourproject.kune.platf.client.dto.StateToken;
import org.ourproject.kune.platf.client.dto.UserDTO;
import org.ourproject.kune.platf.client.dto.UserInfoDTO;
import org.ourproject.kune.platf.client.errors.UserAuthException;
@@ -31,8 +30,7 @@
this.registerProvider = registerProvider;
}
- public void doSignIn(StateToken previousStateToken) {
- this.previousStateToken = previousStateToken;
+ public void doSignIn() {
registerProvider.get().hide();
if (!session.isLogged()) {
Site.showProgressProcessing();
@@ -41,7 +39,7 @@
Site.hideProgress();
view.focusOnNickname();
} else {
- stateManager.gotoToken(previousStateToken);
+ stateManager.restorePreviousToken();
}
}
@@ -88,7 +86,7 @@
public void onSuccess(final UserInfoDTO userInfoDTO) {
onSignIn(userInfoDTO);
- stateManager.gotoToken(previousStateToken);
+ stateManager.restorePreviousToken();
view.hide();
view.unMask();
}
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-10-30 17:13:18 UTC (rev 937)
+++ trunk/src/test/java/org/ourproject/kune/platf/client/state/StateManagerTest.java 2008-11-04 12:32:31 UTC (rev 938)
@@ -1,16 +1,21 @@
package org.ourproject.kune.platf.client.state;
+import static org.junit.Assert.assertTrue;
+
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mockito;
import org.ourproject.kune.platf.client.app.HistoryWrapper;
-import org.ourproject.kune.platf.client.dto.GroupDTO;
import org.ourproject.kune.platf.client.dto.StateAbstractDTO;
import org.ourproject.kune.platf.client.dto.StateToken;
+import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService;
+import org.ourproject.kune.workspace.client.site.Site;
import org.ourproject.kune.workspace.client.site.SiteToken;
+import org.ourproject.kune.workspace.client.sitebar.siteprogress.SiteProgress;
-import com.calclab.suco.client.listener.Listener;
-import com.calclab.suco.client.listener.Listener2;
+import com.calclab.suco.testing.listener.MockListener;
+import com.calclab.suco.testing.listener.MockListener0;
+import com.calclab.suco.testing.listener.MockListener2;
import com.google.gwt.user.client.rpc.AsyncCallback;
public class StateManagerTest {
@@ -20,29 +25,83 @@
private HistoryWrapper history;
private ContentProvider contentProvider;
private Session session;
+ private MockListener2<String, String> toolChangeListener;
+ private MockListener2<String, String> groupChangeListener;
+ private MockListener<StateAbstractDTO> stateChangeListener;
+ private StateAbstractDTO state;
+ private BeforeStateChangeListener beforeChangeListener1;
+ private BeforeStateChangeListener beforeChangeListener2;
- @SuppressWarnings("unchecked")
+ @Before
+ public void before() {
+ contentProvider = Mockito.mock(ContentProvider.class);
+ session = Mockito.mock(Session.class);
+ history = Mockito.mock(HistoryWrapper.class);
+ stateManager = new StateManagerDefault(contentProvider, session, history);
+ Mockito.stub(session.getUserHash()).toReturn(HASH);
+ state = Mockito.mock(StateAbstractDTO.class);
+ stateChangeListener = new MockListener<StateAbstractDTO>();
+ groupChangeListener = new MockListener2<String, String>();
+ toolChangeListener = new MockListener2<String, String>();
+ beforeChangeListener1 = Mockito.mock(BeforeStateChangeListener.class);
+ beforeChangeListener2 = Mockito.mock(BeforeStateChangeListener.class);
+ stateManager.onStateChanged(stateChangeListener);
+ stateManager.onGroupChanged(groupChangeListener);
+ stateManager.onToolChanged(toolChangeListener);
+ new Site(Mockito.mock(I18nUITranslationService.class), Mockito.mock(SiteProgress.class), null);
+ }
+
@Test
+ public void changeGroupWithNoTool() {
+ changeState("group1", "group2");
+ assertTrue(groupChangeListener.isCalledWithEquals("", "group1", "group1", "group2"));
+ assertTrue(toolChangeListener.isCalledWithEquals("", ""));
+ assertTrue(groupChangeListener.isCalled(2));
+ assertTrue(stateChangeListener.isCalled(2));
+ }
+
+ @Test
+ public void changeStateWithDifferentAndGroupsToolsMustFireListener() {
+ changeState("group2.tool1", "group1.tool2");
+ assertTrue(stateChangeListener.isCalled(2));
+ assertTrue(groupChangeListener.isCalledWithEquals("", "group2", "group2", "group1"));
+ assertTrue(toolChangeListener.isCalledWithEquals("", "tool1", "tool1", "tool2"));
+ }
+
+ @Test
public void changeStateWithDifferentGroupsMustFireListener() {
- final Listener2<GroupDTO, GroupDTO> groupListener = Mockito.mock(Listener2.class);
- stateManager.onGroupChanged(groupListener);
- stateManager.onHistoryChanged("group1.tool1");
- stateManager.onHistoryChanged("group2.tool1");
- // TODO, think how to test this
- // Mockito.verify(groupListener).onEvent("group1", "group2");
+ changeState("group1.tool1", "group2.tool1");
+ assertTrue(stateChangeListener.isCalled(2));
+ assertTrue(groupChangeListener.isCalledWithEquals("", "group1", "group1", "group2"));
+ assertTrue(toolChangeListener.isCalledWithEquals("", "tool1"));
}
- @SuppressWarnings("unchecked")
@Test
public void changeStateWithDifferentToolsMustFireListener() {
- final Listener2<String, String> toolListener = Mockito.mock(Listener2.class);
- stateManager.onToolChanged(toolListener);
- stateManager.gotoToken("group1.tool1");
- stateManager.gotoToken("group1.tool2");
- // TODO, think how to test this
- // Mockito.verify(toolListener).onEvent("tool1", "tool2");
+ changeState("group1.tool1", "group1.tool2");
+ assertTrue(stateChangeListener.isCalled(2));
+ assertTrue(toolChangeListener.isCalledWithEquals("", "tool1", "tool1", "tool2"));
+ assertTrue(groupChangeListener.isCalledWithEquals("", "group1"));
}
+ @Test
+ public void changeToNoTool() {
+ changeState("group1.tool1", "group1");
+ assertTrue(groupChangeListener.isCalledWithEquals("", "group1"));
+ assertTrue(toolChangeListener.isCalledWithEquals("", "tool1", "tool1", ""));
+ assertTrue(groupChangeListener.isCalledOnce());
+ assertTrue(stateChangeListener.isCalled(2));
+ }
+
+ @Test
+ public void changeToSameToken() {
+ changeState("group1.tool1", "group1.tool1");
+ assertTrue(groupChangeListener.isCalledWithEquals("", "group1"));
+ assertTrue(toolChangeListener.isCalledWithEquals("", "tool1"));
+ assertTrue(groupChangeListener.isCalledOnce());
+ assertTrue(stateChangeListener.isCalled(2));
+ }
+
@SuppressWarnings("unchecked")
@Test
public void getDefGroup() {
@@ -51,15 +110,6 @@
(StateToken) Mockito.anyObject(), (AsyncCallback<StateAbstractDTO>) Mockito.anyObject());
}
- @Before
- public void init() {
- contentProvider = Mockito.mock(ContentProvider.class);
- session = Mockito.mock(Session.class);
- history = Mockito.mock(HistoryWrapper.class);
- stateManager = new StateManagerDefault(contentProvider, session, history);
- Mockito.stub(session.getUserHash()).toReturn(HASH);
- }
-
@SuppressWarnings("unchecked")
@Test
public void normalStartLoggedUser() {
@@ -74,47 +124,44 @@
@SuppressWarnings("unchecked")
@Test
public void oneBeforeStateChangeListenerAddAndRemove() {
- BeforeStateChangeListener listener1 = Mockito.mock(BeforeStateChangeListener.class);
- BeforeStateChangeListener listener2 = Mockito.mock(BeforeStateChangeListener.class);
- String newToken = "something";
- Mockito.stub(listener1.beforeChange(newToken)).toReturn(false);
- Mockito.stub(listener2.beforeChange(newToken)).toReturn(false);
- stateManager.addBeforeStateChangeListener(listener1);
- stateManager.addBeforeStateChangeListener(listener2);
- stateManager.removeBeforeStateChangeListener(listener1);
- stateManager.removeBeforeStateChangeListener(listener2);
+ String newToken = confBeforeStateChangeListeners(false, false);
stateManager.onHistoryChanged(newToken);
+ removeBeforeStateChangeListener();
+ stateManager.onHistoryChanged(newToken);
Mockito.verify(contentProvider, Mockito.times(1)).getContent(Mockito.anyString(),
(StateToken) Mockito.anyObject(), (AsyncCallback<StateAbstractDTO>) Mockito.anyObject());
+ }
+ @Test
+ public void oneBeforeStateChangeListenerFalseAndResume() {
+ String token = confBeforeStateChangeListeners(false, true);
+ stateManager.onHistoryChanged(token);
+ Mockito.verify(history, Mockito.never()).newItem(token);
+ removeBeforeStateChangeListener();
+ stateManager.resumeTokenChange();
+ Mockito.verify(history, Mockito.times(1)).newItem(token);
}
@SuppressWarnings("unchecked")
@Test
public void oneBeforeStateChangeListenerReturnFalse() {
- BeforeStateChangeListener listener1 = Mockito.mock(BeforeStateChangeListener.class);
- BeforeStateChangeListener listener2 = Mockito.mock(BeforeStateChangeListener.class);
- String newToken = "something";
- Mockito.stub(listener1.beforeChange(newToken)).toReturn(true);
- Mockito.stub(listener2.beforeChange(newToken)).toReturn(false);
- stateManager.addBeforeStateChangeListener(listener1);
- stateManager.addBeforeStateChangeListener(listener2);
- stateManager.onHistoryChanged(newToken);
+ stateManager.onHistoryChanged(confBeforeStateChangeListeners(true, false));
Mockito.verify(contentProvider, Mockito.never()).getContent(Mockito.anyString(),
(StateToken) Mockito.anyObject(), (AsyncCallback<StateAbstractDTO>) Mockito.anyObject());
}
@SuppressWarnings("unchecked")
@Test
+ public void oneBeforeStateChangeListenerReturnFalseWithTwo() {
+ stateManager.onHistoryChanged(confBeforeStateChangeListeners(false, false));
+ Mockito.verify(contentProvider, Mockito.never()).getContent(Mockito.anyString(),
+ (StateToken) Mockito.anyObject(), (AsyncCallback<StateAbstractDTO>) Mockito.anyObject());
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test
public void oneBeforeStateChangeListenerReturnTrue() {
- BeforeStateChangeListener listener1 = Mockito.mock(BeforeStateChangeListener.class);
- BeforeStateChangeListener listener2 = Mockito.mock(BeforeStateChangeListener.class);
- String newToken = "something";
- Mockito.stub(listener1.beforeChange(newToken)).toReturn(true);
- Mockito.stub(listener2.beforeChange(newToken)).toReturn(true);
- stateManager.addBeforeStateChangeListener(listener1);
- stateManager.addBeforeStateChangeListener(listener2);
- stateManager.onHistoryChanged(newToken);
+ stateManager.onHistoryChanged(confBeforeStateChangeListeners(true, true));
Mockito.verify(contentProvider, Mockito.times(1)).getContent(Mockito.anyString(),
(StateToken) Mockito.anyObject(), (AsyncCallback<StateAbstractDTO>) Mockito.anyObject());
}
@@ -122,13 +169,41 @@
@SuppressWarnings("unchecked")
@Test
public void siteTokenFirstLoadDefContentAndFireListener() {
- final Listener listener = Mockito.mock(Listener.class);
+ final MockListener0 listener = new MockListener0();
final String token = SiteToken.signin.toString();
stateManager.addSiteToken(token, listener);
stateManager.onHistoryChanged(token);
- Mockito.verify(listener, Mockito.times(1)).onEvent(Mockito.anyObject());
+ assertTrue(listener.isCalledOnce());
Mockito.verify(contentProvider, Mockito.times(1)).getContent(Mockito.anyString(),
(StateToken) Mockito.anyObject(), (AsyncCallback<StateAbstractDTO>) Mockito.anyObject());
}
+ @Test
+ public void siteTokenTest() {
+ MockListener0 siteTokenListener = new MockListener0();
+ stateManager.addSiteToken("signin", siteTokenListener);
+ stateManager.onHistoryChanged("signIn");
+ siteTokenListener.isCalledOnce();
+ }
+
+ private void changeState(String... tokens) {
+ for (String token : tokens) {
+ Mockito.stub(state.getStateToken()).toReturn(new StateToken(token));
+ stateManager.setState(state);
+ }
+ }
+
+ private String confBeforeStateChangeListeners(boolean value, boolean value2) {
+ stateManager.addBeforeStateChangeListener(beforeChangeListener1);
+ stateManager.addBeforeStateChangeListener(beforeChangeListener2);
+ String newToken = "something";
+ Mockito.stub(beforeChangeListener1.beforeChange(newToken)).toReturn(value);
+ Mockito.stub(beforeChangeListener2.beforeChange(newToken)).toReturn(value2);
+ return newToken;
+ }
+
+ private void removeBeforeStateChangeListener() {
+ stateManager.removeBeforeStateChangeListener(beforeChangeListener1);
+ stateManager.removeBeforeStateChangeListener(beforeChangeListener2);
+ }
}
Modified: trunk/src/test/java/org/ourproject/kune/platf/client/tool/ToolSelectorPresenterTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/client/tool/ToolSelectorPresenterTest.java 2008-10-30 17:13:18 UTC (rev 937)
+++ trunk/src/test/java/org/ourproject/kune/platf/client/tool/ToolSelectorPresenterTest.java 2008-11-04 12:32:31 UTC (rev 938)
@@ -58,7 +58,7 @@
public void setStateFirstMustSelect() {
setToolNames();
toolSelector.addTool(toolSelectorItem1);
- toolSelector.onToolChanged(null, TOOL1_NAME);
+ toolSelector.onToolChanged("", TOOL1_NAME);
Mockito.verify(toolSelectorItem1, Mockito.times(1)).setSelected(false);
Mockito.verify(toolSelectorItem1, Mockito.times(1)).setSelected(true);
}
@@ -89,7 +89,7 @@
setToolNames();
toolSelector.addTool(toolSelectorItem1);
toolSelector.addTool(toolSelectorItem2);
- toolSelector.onToolChanged(TOOL1_NAME, null);
+ toolSelector.onToolChanged(TOOL1_NAME, "");
Mockito.verify(toolSelectorItem2, Mockito.times(1)).setSelected(false);
Mockito.verify(toolSelectorItem1, Mockito.times(2)).setSelected(false);
Mockito.verify(toolSelectorItem2, Mockito.never()).setSelected(true);
Modified: trunk/src/test/java/org/ourproject/kune/workspace/client/editor/TextEditorPresenterTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/workspace/client/editor/TextEditorPresenterTest.java 2008-10-30 17:13:18 UTC (rev 937)
+++ trunk/src/test/java/org/ourproject/kune/workspace/client/editor/TextEditorPresenterTest.java 2008-11-04 12:32:31 UTC (rev 938)
@@ -38,7 +38,7 @@
@Test
public void historyChangeWithoutPendingMustAccept() {
presenter.editContent("Text to edit", saveListener, cancelListener);
- boolean change = presenter.beforeTokenChange("somegroup");
+ boolean change = presenter.beforeTokenChange();
assertTrue(change);
Mockito.verify(view, Mockito.never()).showSaveBeforeDialog();
Mockito.verify(toolbar, Mockito.times(1)).detach();
@@ -46,19 +46,19 @@
@Test
public void historyChangeWithPendingSaveAndCancelMustPosponeIt() {
- String newToken = editAndChangeHistoryToken();
+ editAndChangeHistoryToken();
presenter.onCancelConfirmed();
assertTrue(saveListener.isNotCalled());
- Mockito.verify(stateManager, Mockito.times(1)).gotoToken(newToken);
+ Mockito.verify(stateManager, Mockito.times(1)).resumeTokenChange();
}
@Test
public void historyChangeWithPendingSaveMustPosponeIt() {
- String newToken = editAndChangeHistoryToken();
+ editAndChangeHistoryToken();
presenter.onSaveAndClose();
presenter.onSaved();
assertTrue(saveListener.isCalledOnce());
- Mockito.verify(stateManager, Mockito.times(1)).gotoToken(newToken);
+ Mockito.verify(stateManager, Mockito.times(1)).resumeTokenChange();
}
@Test
@@ -118,7 +118,7 @@
presenter.editContent("Text to edit", saveListener, cancelListener);
presenter.onEdit();
String newToken = "somegroup";
- boolean change = presenter.beforeTokenChange(newToken);
+ boolean change = presenter.beforeTokenChange();
assertFalse(change);
Mockito.verify(view, Mockito.times(1)).showSaveBeforeDialog();
return newToken;
1
0