[kune-commits] r1483 - in trunk/src: main/java/cc/kune/barters/client/actions main/java/cc/kune/blogs/client/actions main/java/cc/kune/chat/client/actions main/java/cc/kune/common/client/actions/gwtui main/java/cc/kune/common/client/ui main/java/cc/kune/core/public main/java/cc/kune/docs/client/actions main/java/cc/kune/gspace/client main/java/cc/kune/gspace/client/actions main/java/cc/kune/gspace/client/viewers main/java/cc/kune/meets/client/actions main/java/cc/kune/wiki/client/actions test/java/cc/kune/gspace/client/viewers
Vicente J. Ruiz Jurado
vjrj_ at ourproject.org
Sat Aug 6 12:41:11 CEST 2011
Author: vjrj_
Date: 2011-08-06 12:41:10 +0200 (Sat, 06 Aug 2011)
New Revision: 1483
Added:
trunk/src/main/java/cc/kune/blogs/client/actions/NewPostIconBtn.java
trunk/src/main/java/cc/kune/docs/client/actions/NewDocIconBtn.java
trunk/src/main/java/cc/kune/gspace/client/actions/NewContentAction.java
trunk/src/main/java/cc/kune/gspace/client/viewers/PathToolbarUtils.java
trunk/src/main/java/cc/kune/wiki/client/actions/NewWikiIconBtn.java
trunk/src/main/java/cc/kune/wiki/client/actions/NewWikiMenuItem.java
Removed:
trunk/src/main/java/cc/kune/wiki/client/actions/NewWikiBtn.java
Modified:
trunk/src/main/java/cc/kune/barters/client/actions/BartersClientActions.java
trunk/src/main/java/cc/kune/barters/client/actions/GoParentFolderBtn.java
trunk/src/main/java/cc/kune/barters/client/actions/NewBartersBtn.java
trunk/src/main/java/cc/kune/blogs/client/actions/BlogsClientActions.java
trunk/src/main/java/cc/kune/blogs/client/actions/GoParentBlogBtn.java
trunk/src/main/java/cc/kune/blogs/client/actions/NewPostMenuItem.java
trunk/src/main/java/cc/kune/chat/client/actions/ChatAboutContentBtn.java
trunk/src/main/java/cc/kune/chat/client/actions/ChatClientActions.java
trunk/src/main/java/cc/kune/chat/client/actions/GoParentChatBtn.java
trunk/src/main/java/cc/kune/common/client/actions/gwtui/AbstractGwtButtonGui.java
trunk/src/main/java/cc/kune/common/client/ui/EditableLabel.java
trunk/src/main/java/cc/kune/core/public/ws.css
trunk/src/main/java/cc/kune/docs/client/actions/DocsClientActions.java
trunk/src/main/java/cc/kune/docs/client/actions/GoParentFolderBtn.java
trunk/src/main/java/cc/kune/docs/client/actions/NewDocMenuItem.java
trunk/src/main/java/cc/kune/gspace/client/GSpaceGinModule.java
trunk/src/main/java/cc/kune/gspace/client/actions/GoParentContainerBtn.java
trunk/src/main/java/cc/kune/gspace/client/actions/NewContentBtn.java
trunk/src/main/java/cc/kune/gspace/client/actions/NewContentMenuItem.java
trunk/src/main/java/cc/kune/gspace/client/viewers/ContentViewerPresenter.java
trunk/src/main/java/cc/kune/gspace/client/viewers/FolderViewerPresenter.java
trunk/src/main/java/cc/kune/meets/client/actions/GoParentFolderBtn.java
trunk/src/main/java/cc/kune/meets/client/actions/MeetingsClientActions.java
trunk/src/main/java/cc/kune/meets/client/actions/NewMeetingsBtn.java
trunk/src/main/java/cc/kune/wiki/client/actions/GoParentFolderBtn.java
trunk/src/main/java/cc/kune/wiki/client/actions/WikiClientActions.java
trunk/src/test/java/cc/kune/gspace/client/viewers/FolderViewerPresenterTest.java
Log:
CLOSED - # 83: New doc icon/menuitem also when in a doc
http://kune.ourproject.org/issues/ticket/83
CLOSED - # 84: Show location tree where you are in group space
http://kune.ourproject.org/issues/ticket/84
Modified: trunk/src/main/java/cc/kune/barters/client/actions/BartersClientActions.java
===================================================================
--- trunk/src/main/java/cc/kune/barters/client/actions/BartersClientActions.java 2011-08-04 14:24:49 UTC (rev 1482)
+++ trunk/src/main/java/cc/kune/barters/client/actions/BartersClientActions.java 2011-08-06 10:41:10 UTC (rev 1483)
@@ -56,7 +56,7 @@
actionsRegistry.addAction(ActionGroups.TOOLBAR, optionsMenuContent, all);
actionsRegistry.addAction(ActionGroups.TOOLBAR, refresh, all);
actionsRegistry.addAction(ActionGroups.TOOLBAR, folderGoUp, contents);
- actionsRegistry.addAction(ActionGroups.TOOLBAR, folderGoUp, containersNoRoot);
+ actionsRegistry.addAction(ActionGroups.TOOLBAR, folderGoUp, containers);
actionsRegistry.addAction(ActionGroups.TOOLBAR, newBartersBtn, containers);
actionsRegistry.addAction(ActionGroups.TOOLBAR, participateBtn, contents);
actionsRegistry.addAction(ActionGroups.TOOLBAR, newFolderBtn, containers);
Modified: trunk/src/main/java/cc/kune/barters/client/actions/GoParentFolderBtn.java
===================================================================
--- trunk/src/main/java/cc/kune/barters/client/actions/GoParentFolderBtn.java 2011-08-04 14:24:49 UTC (rev 1482)
+++ trunk/src/main/java/cc/kune/barters/client/actions/GoParentFolderBtn.java 2011-08-06 10:41:10 UTC (rev 1483)
@@ -19,7 +19,9 @@
*/
package cc.kune.barters.client.actions;
+import cc.kune.barters.shared.BartersConstants;
import cc.kune.core.client.resources.CoreResources;
+import cc.kune.core.client.state.Session;
import cc.kune.core.shared.i18n.I18nTranslationService;
import cc.kune.gspace.client.actions.GoParentContainerBtn;
@@ -27,9 +29,10 @@
public class GoParentFolderBtn extends GoParentContainerBtn {
- @Inject
- public GoParentFolderBtn(final I18nTranslationService i18n, final GoParentContainerAction action, final CoreResources res) {
- super(i18n, action, res);
- }
+ @Inject
+ public GoParentFolderBtn(final I18nTranslationService i18n, final GoParentContainerAction action,
+ final CoreResources res, final Session session) {
+ super(i18n, action, res, session, BartersConstants.TYPE_ROOT);
+ }
}
Modified: trunk/src/main/java/cc/kune/barters/client/actions/NewBartersBtn.java
===================================================================
--- trunk/src/main/java/cc/kune/barters/client/actions/NewBartersBtn.java 2011-08-04 14:24:49 UTC (rev 1482)
+++ trunk/src/main/java/cc/kune/barters/client/actions/NewBartersBtn.java 2011-08-06 10:41:10 UTC (rev 1483)
@@ -23,6 +23,7 @@
import cc.kune.common.client.shortcuts.GlobalShortcutRegister;
import cc.kune.core.client.resources.nav.NavResources;
import cc.kune.core.shared.i18n.I18nTranslationService;
+import cc.kune.gspace.client.actions.NewContentAction;
import cc.kune.gspace.client.actions.NewContentBtn;
import com.google.inject.Inject;
Modified: trunk/src/main/java/cc/kune/blogs/client/actions/BlogsClientActions.java
===================================================================
--- trunk/src/main/java/cc/kune/blogs/client/actions/BlogsClientActions.java 2011-08-04 14:24:49 UTC (rev 1482)
+++ trunk/src/main/java/cc/kune/blogs/client/actions/BlogsClientActions.java 2011-08-06 10:41:10 UTC (rev 1483)
@@ -47,12 +47,14 @@
final String[] containersNoRoot = { TYPE_BLOG };
final String[] contents = { TYPE_POST, TYPE_UPLOADEDFILE };
final String[] contentsModerated = { TYPE_POST, TYPE_UPLOADEDFILE };
+ final String[] noRoot = { TYPE_BLOG, TYPE_POST, TYPE_UPLOADEDFILE };
@Inject
public BlogsClientActions(final I18nUITranslationService i18n, final Session session,
final StateManager stateManager, final ActionRegistryByType registry, final CoreResources res,
- final Provider<GoParentBlogBtn> folderGoUp, final Provider<NewPostMenuItem> newDocBtn,
- final Provider<NewBlogBtn> newFolderBtn, final Provider<OpenBlogMenuItem> openContentMenuItem,
+ final Provider<GoParentBlogBtn> folderGoUp, final Provider<NewPostMenuItem> newPostItem,
+ final Provider<NewPostIconBtn> newPostIconBtn, final Provider<NewBlogBtn> newFolderBtn,
+ final Provider<OpenBlogMenuItem> openContentMenuItem,
final Provider<DelPostMenuItem> delContentMenuItem,
final Provider<RefreshContentMenuItem> refresh,
final Provider<ContentViewerOptionsMenu> optionsMenuContent,
@@ -64,11 +66,12 @@
actionsRegistry.addAction(ActionGroups.TOOLBAR, optionsMenuContent, all);
actionsRegistry.addAction(ActionGroups.TOOLBAR, blogNewMenu, TYPE_BLOG);
actionsRegistry.addAction(ActionGroups.TOOLBAR, refresh, all);
+ actionsRegistry.addAction(ActionGroups.TOOLBAR, newPostItem, containersNoRoot);
+ actionsRegistry.addAction(ActionGroups.TOOLBAR, newPostIconBtn, noRoot);
+ actionsRegistry.addAction(ActionGroups.TOOLBAR, newFolderBtn, TYPE_ROOT);
actionsRegistry.addAction(ActionGroups.TOOLBAR, folderGoUp, contents);
- actionsRegistry.addAction(ActionGroups.TOOLBAR, folderGoUp, containersNoRoot);
+ actionsRegistry.addAction(ActionGroups.TOOLBAR, folderGoUp, containers);
actionsRegistry.addAction(ActionGroups.TOOLBAR, participateBtn, contents);
- actionsRegistry.addAction(ActionGroups.TOOLBAR, newDocBtn, containersNoRoot);
- actionsRegistry.addAction(ActionGroups.TOOLBAR, newFolderBtn, TYPE_ROOT);
actionsRegistry.addAction(ActionGroups.TOOLBAR, chatAbout, contents);
actionsRegistry.addAction(ActionGroups.ITEM_MENU, openContentMenuItem, contents);
actionsRegistry.addAction(ActionGroups.ITEM_MENU, openContentMenuItem, containersNoRoot);
Modified: trunk/src/main/java/cc/kune/blogs/client/actions/GoParentBlogBtn.java
===================================================================
--- trunk/src/main/java/cc/kune/blogs/client/actions/GoParentBlogBtn.java 2011-08-04 14:24:49 UTC (rev 1482)
+++ trunk/src/main/java/cc/kune/blogs/client/actions/GoParentBlogBtn.java 2011-08-06 10:41:10 UTC (rev 1483)
@@ -19,7 +19,9 @@
*/
package cc.kune.blogs.client.actions;
+import cc.kune.blogs.shared.BlogsConstants;
import cc.kune.core.client.resources.CoreResources;
+import cc.kune.core.client.state.Session;
import cc.kune.core.shared.i18n.I18nTranslationService;
import cc.kune.gspace.client.actions.GoParentContainerBtn;
@@ -27,10 +29,10 @@
public class GoParentBlogBtn extends GoParentContainerBtn {
- @Inject
- public GoParentBlogBtn(final I18nTranslationService i18n, final GoParentContainerAction action,
- final CoreResources res) {
- super(i18n, action, res);
- }
+ @Inject
+ public GoParentBlogBtn(final I18nTranslationService i18n, final GoParentContainerAction action,
+ final CoreResources res, final Session session) {
+ super(i18n, action, res, session, BlogsConstants.TYPE_ROOT);
+ }
}
Added: trunk/src/main/java/cc/kune/blogs/client/actions/NewPostIconBtn.java
===================================================================
--- trunk/src/main/java/cc/kune/blogs/client/actions/NewPostIconBtn.java (rev 0)
+++ trunk/src/main/java/cc/kune/blogs/client/actions/NewPostIconBtn.java 2011-08-06 10:41:10 UTC (rev 1483)
@@ -0,0 +1,41 @@
+/*
+ *
+ * Copyright (C) 2007-2011 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 cc.kune.blogs.client.actions;
+
+import cc.kune.blogs.shared.BlogsConstants;
+import cc.kune.common.client.shortcuts.GlobalShortcutRegister;
+import cc.kune.core.client.resources.nav.NavResources;
+import cc.kune.core.shared.i18n.I18nTranslationService;
+import cc.kune.gspace.client.actions.NewContentAction;
+import cc.kune.gspace.client.actions.NewContentBtn;
+
+import com.google.inject.Inject;
+
+public class NewPostIconBtn extends NewContentBtn {
+
+ @Inject
+ public NewPostIconBtn(final I18nTranslationService i18n, final NewContentAction action,
+ final NavResources res, final GlobalShortcutRegister shorcutReg) {
+ super(i18n, action, res.blogAdd(), shorcutReg, "", i18n.t("Create a new blog post"),
+ i18n.t("New post"), BlogsConstants.TYPE_POST);
+ withStyles("k-btn-min, k-fl");
+ }
+
+}
Modified: trunk/src/main/java/cc/kune/blogs/client/actions/NewPostMenuItem.java
===================================================================
--- trunk/src/main/java/cc/kune/blogs/client/actions/NewPostMenuItem.java 2011-08-04 14:24:49 UTC (rev 1482)
+++ trunk/src/main/java/cc/kune/blogs/client/actions/NewPostMenuItem.java 2011-08-06 10:41:10 UTC (rev 1483)
@@ -23,6 +23,7 @@
import cc.kune.common.client.shortcuts.GlobalShortcutRegister;
import cc.kune.core.client.resources.nav.NavResources;
import cc.kune.core.shared.i18n.I18nTranslationService;
+import cc.kune.gspace.client.actions.NewContentAction;
import cc.kune.gspace.client.actions.NewContentMenuItem;
import com.google.inject.Inject;
Modified: trunk/src/main/java/cc/kune/chat/client/actions/ChatAboutContentBtn.java
===================================================================
--- trunk/src/main/java/cc/kune/chat/client/actions/ChatAboutContentBtn.java 2011-08-04 14:24:49 UTC (rev 1482)
+++ trunk/src/main/java/cc/kune/chat/client/actions/ChatAboutContentBtn.java 2011-08-06 10:41:10 UTC (rev 1483)
@@ -67,6 +67,6 @@
final I18nTranslationService i18n) {
super(action);
this.withIcon(res.emiteRoom()).withToolTip(i18n.t("Chat and comment this")).withText(
- i18n.t("Chat about")).withStyles("k-def-docbtn, k-fr").withId(ID);
+ i18n.t("Chat about")).withStyles("k-def-docbtn, k-fl").withId(ID);
}
}
Modified: trunk/src/main/java/cc/kune/chat/client/actions/ChatClientActions.java
===================================================================
--- trunk/src/main/java/cc/kune/chat/client/actions/ChatClientActions.java 2011-08-04 14:24:49 UTC (rev 1482)
+++ trunk/src/main/java/cc/kune/chat/client/actions/ChatClientActions.java 2011-08-06 10:41:10 UTC (rev 1483)
@@ -53,7 +53,7 @@
actionsRegistry.addAction(ActionGroups.TOOLBAR, optionsMenuContent, all);
actionsRegistry.addAction(ActionGroups.TOOLBAR, refresh, all);
actionsRegistry.addAction(ActionGroups.TOOLBAR, newRoomBtn, TYPE_ROOT);
- actionsRegistry.addAction(ActionGroups.TOOLBAR, folderGoUp, containersNoRoot);
+ actionsRegistry.addAction(ActionGroups.TOOLBAR, folderGoUp, containers);
actionsRegistry.addAction(ActionGroups.TOOLBAR, openRoomBtn, containersNoRoot);
actionsRegistry.addAction(ActionGroups.ITEM_MENU, openRoomMenuItem, containersNoRoot);
actionsRegistry.addAction(ActionGroups.ITEM_MENU, openRoomArchiveMenuItem, containersNoRoot);
Modified: trunk/src/main/java/cc/kune/chat/client/actions/GoParentChatBtn.java
===================================================================
--- trunk/src/main/java/cc/kune/chat/client/actions/GoParentChatBtn.java 2011-08-04 14:24:49 UTC (rev 1482)
+++ trunk/src/main/java/cc/kune/chat/client/actions/GoParentChatBtn.java 2011-08-06 10:41:10 UTC (rev 1483)
@@ -19,7 +19,9 @@
*/
package cc.kune.chat.client.actions;
+import cc.kune.chat.shared.ChatConstants;
import cc.kune.core.client.resources.CoreResources;
+import cc.kune.core.client.state.Session;
import cc.kune.core.shared.i18n.I18nTranslationService;
import cc.kune.gspace.client.actions.GoParentContainerBtn;
@@ -27,10 +29,10 @@
public class GoParentChatBtn extends GoParentContainerBtn {
- @Inject
- public GoParentChatBtn(final I18nTranslationService i18n, final GoParentContainerAction action,
- final CoreResources res) {
- super(i18n, action, res);
- }
+ @Inject
+ public GoParentChatBtn(final I18nTranslationService i18n, final GoParentContainerAction action,
+ final CoreResources res, final Session session) {
+ super(i18n, action, res, session, ChatConstants.TYPE_ROOT);
+ }
}
Modified: trunk/src/main/java/cc/kune/common/client/actions/gwtui/AbstractGwtButtonGui.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/actions/gwtui/AbstractGwtButtonGui.java 2011-08-04 14:24:49 UTC (rev 1482)
+++ trunk/src/main/java/cc/kune/common/client/actions/gwtui/AbstractGwtButtonGui.java 2011-08-06 10:41:10 UTC (rev 1483)
@@ -114,6 +114,7 @@
@Override
public void setEnabled(final boolean enabled) {
button.setEnabled(enabled);
+ button.getElement().getStyle().setOpacity(enabled ? 1d : 0.5d);
}
@Override
Modified: trunk/src/main/java/cc/kune/common/client/ui/EditableLabel.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/ui/EditableLabel.java 2011-08-04 14:24:49 UTC (rev 1482)
+++ trunk/src/main/java/cc/kune/common/client/ui/EditableLabel.java 2011-08-06 10:41:10 UTC (rev 1483)
@@ -117,17 +117,7 @@
blinkTimer(false, new SimpleCallback() {
@Override
public void onCallback() {
- blinkTimer(true, new SimpleCallback() {
- @Override
- public void onCallback() {
- blinkTimer(false, new SimpleCallback() {
- @Override
- public void onCallback() {
- tooltip.showTemporally();
- }
- });
- }
- });
+ tooltip.showTemporally();
}
});
}
Modified: trunk/src/main/java/cc/kune/core/public/ws.css
===================================================================
--- trunk/src/main/java/cc/kune/core/public/ws.css 2011-08-04 14:24:49 UTC (rev 1482)
+++ trunk/src/main/java/cc/kune/core/public/ws.css 2011-08-06 10:41:10 UTC (rev 1483)
@@ -945,6 +945,7 @@
.k-sn-novisible-label {
padding: 10px;
+ width: auto !important;
}
.k-sn-1st-panel { /* background-color: #a05a2c; */
Modified: trunk/src/main/java/cc/kune/docs/client/actions/DocsClientActions.java
===================================================================
--- trunk/src/main/java/cc/kune/docs/client/actions/DocsClientActions.java 2011-08-04 14:24:49 UTC (rev 1482)
+++ trunk/src/main/java/cc/kune/docs/client/actions/DocsClientActions.java 2011-08-06 10:41:10 UTC (rev 1483)
@@ -52,8 +52,8 @@
@Inject
public DocsClientActions(final I18nUITranslationService i18n, final Session session,
final StateManager stateManager, final ActionRegistryByType registry, final CoreResources res,
- final Provider<GoParentFolderBtn> folderGoUp, final Provider<NewDocMenuItem> newDocBtn,
- final Provider<NewFolderMenuItem> newFolderBtn,
+ final Provider<GoParentFolderBtn> folderGoUp, final Provider<NewDocMenuItem> newDocMenuItem,
+ final Provider<NewDocIconBtn> newDocIconBtn, final Provider<NewFolderMenuItem> newFolderBtn,
final Provider<OpenDocMenuItem> openContentMenuItem,
final Provider<DelDocMenuItem> delContentMenuItem,
final Provider<ContentViewerOptionsMenu> optionsMenuContent,
@@ -66,9 +66,10 @@
actionsRegistry.addAction(ActionGroups.TOOLBAR, optionsMenuContent, all);
actionsRegistry.addAction(ActionGroups.TOOLBAR, folderNewMenu, containers);
actionsRegistry.addAction(ActionGroups.TOOLBAR, refresh, all);
+ actionsRegistry.addAction(ActionGroups.TOOLBAR, newDocMenuItem, containers);
+ actionsRegistry.addAction(ActionGroups.TOOLBAR, newDocIconBtn, all);
actionsRegistry.addAction(ActionGroups.TOOLBAR, folderGoUp, contents);
- actionsRegistry.addAction(ActionGroups.TOOLBAR, folderGoUp, containersNoRoot);
- actionsRegistry.addAction(ActionGroups.TOOLBAR, newDocBtn, containers);
+ actionsRegistry.addAction(ActionGroups.TOOLBAR, folderGoUp, containers);
actionsRegistry.addAction(ActionGroups.TOOLBAR, participateBtn, contents);
actionsRegistry.addAction(ActionGroups.TOOLBAR, newFolderBtn, containers);
actionsRegistry.addAction(ActionGroups.TOOLBAR, chatAbout, contents);
Modified: trunk/src/main/java/cc/kune/docs/client/actions/GoParentFolderBtn.java
===================================================================
--- trunk/src/main/java/cc/kune/docs/client/actions/GoParentFolderBtn.java 2011-08-04 14:24:49 UTC (rev 1482)
+++ trunk/src/main/java/cc/kune/docs/client/actions/GoParentFolderBtn.java 2011-08-06 10:41:10 UTC (rev 1483)
@@ -20,7 +20,9 @@
package cc.kune.docs.client.actions;
import cc.kune.core.client.resources.CoreResources;
+import cc.kune.core.client.state.Session;
import cc.kune.core.shared.i18n.I18nTranslationService;
+import cc.kune.docs.shared.DocsConstants;
import cc.kune.gspace.client.actions.GoParentContainerBtn;
import com.google.inject.Inject;
@@ -29,8 +31,8 @@
@Inject
public GoParentFolderBtn(final I18nTranslationService i18n, final GoParentContainerAction action,
- final CoreResources res) {
- super(i18n, action, res);
+ final CoreResources res, final Session session) {
+ super(i18n, action, res, session, DocsConstants.TYPE_ROOT);
}
}
Added: trunk/src/main/java/cc/kune/docs/client/actions/NewDocIconBtn.java
===================================================================
--- trunk/src/main/java/cc/kune/docs/client/actions/NewDocIconBtn.java (rev 0)
+++ trunk/src/main/java/cc/kune/docs/client/actions/NewDocIconBtn.java 2011-08-06 10:41:10 UTC (rev 1483)
@@ -0,0 +1,42 @@
+/*
+ *
+ * Copyright (C) 2007-2011 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 cc.kune.docs.client.actions;
+
+import cc.kune.common.client.shortcuts.GlobalShortcutRegister;
+import cc.kune.core.client.resources.nav.NavResources;
+import cc.kune.core.shared.i18n.I18nTranslationService;
+import cc.kune.docs.shared.DocsConstants;
+import cc.kune.gspace.client.actions.NewContentAction;
+import cc.kune.gspace.client.actions.NewContentBtn;
+
+import com.google.inject.Inject;
+
+public class NewDocIconBtn extends NewContentBtn {
+
+ @Inject
+ public NewDocIconBtn(final I18nTranslationService i18n, final NewContentAction action,
+ final NavResources res, final GlobalShortcutRegister shorcutReg) {
+ super(i18n, action, res.pageAdd(), shorcutReg, "", i18n.t("Create a New Document. "
+ + "This document will be a new 'Page' in the public web if you publish it"),
+ i18n.t("New document"), DocsConstants.TYPE_DOCUMENT);
+ withStyles("k-btn-min, k-fl");
+ }
+
+}
Modified: trunk/src/main/java/cc/kune/docs/client/actions/NewDocMenuItem.java
===================================================================
--- trunk/src/main/java/cc/kune/docs/client/actions/NewDocMenuItem.java 2011-08-04 14:24:49 UTC (rev 1482)
+++ trunk/src/main/java/cc/kune/docs/client/actions/NewDocMenuItem.java 2011-08-06 10:41:10 UTC (rev 1483)
@@ -23,6 +23,7 @@
import cc.kune.core.client.resources.nav.NavResources;
import cc.kune.core.shared.i18n.I18nTranslationService;
import cc.kune.docs.shared.DocsConstants;
+import cc.kune.gspace.client.actions.NewContentAction;
import cc.kune.gspace.client.actions.NewContentMenuItem;
import com.google.inject.Inject;
Modified: trunk/src/main/java/cc/kune/gspace/client/GSpaceGinModule.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/GSpaceGinModule.java 2011-08-04 14:24:49 UTC (rev 1482)
+++ trunk/src/main/java/cc/kune/gspace/client/GSpaceGinModule.java 2011-08-06 10:41:10 UTC (rev 1483)
@@ -99,6 +99,7 @@
import cc.kune.gspace.client.viewers.FolderViewerAsTablePanel;
import cc.kune.gspace.client.viewers.FolderViewerPresenter;
import cc.kune.gspace.client.viewers.NoHomePageViewer;
+import cc.kune.gspace.client.viewers.PathToolbarUtils;
import com.google.inject.Singleton;
@@ -111,6 +112,8 @@
*/
@Override
protected void configure() {
+ s(PathToolbarUtils.class);
+
bindPresenter(EntityLicensePresenter.class, EntityLicensePresenter.EntityLicenseView.class,
EntityLicensePanel.class, EntityLicensePresenter.EntityLicenseProxy.class);
bindPresenter(TagsSummaryPresenter.class, TagsSummaryPresenter.TagsSummaryView.class,
Modified: trunk/src/main/java/cc/kune/gspace/client/actions/GoParentContainerBtn.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/actions/GoParentContainerBtn.java 2011-08-04 14:24:49 UTC (rev 1482)
+++ trunk/src/main/java/cc/kune/gspace/client/actions/GoParentContainerBtn.java 2011-08-06 10:41:10 UTC (rev 1483)
@@ -66,10 +66,17 @@
}
public GoParentContainerBtn(final I18nTranslationService i18n, final GoParentContainerAction action,
- final CoreResources res) {
+ final CoreResources res, final Session session, final String typeRoot) {
super(action);
this.withToolTip(i18n.t("Go up: Open the container folder")).withIcon(res.folderGoUp()).withStyles(
- "k-btn-min, k-fl");
+ "k-btn-min, k-fr");
+ final StateAbstractDTO state = session.getCurrentState();
+ if (!session.isCurrentStateAContent()) {
+ final StateContainerDTO stateContainer = (StateContainerDTO) state;
+ if (stateContainer.getTypeId().equals(typeRoot)) {
+ setEnabled(false);
+ }
+ }
}
}
Added: trunk/src/main/java/cc/kune/gspace/client/actions/NewContentAction.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/actions/NewContentAction.java (rev 0)
+++ trunk/src/main/java/cc/kune/gspace/client/actions/NewContentAction.java 2011-08-06 10:41:10 UTC (rev 1483)
@@ -0,0 +1,65 @@
+package cc.kune.gspace.client.actions;
+
+import cc.kune.common.client.actions.ActionEvent;
+import cc.kune.common.client.notify.NotifyUser;
+import cc.kune.core.client.actions.RolAction;
+import cc.kune.core.client.rpcservices.AsyncCallbackSimple;
+import cc.kune.core.client.rpcservices.ContentServiceAsync;
+import cc.kune.core.client.state.ContentCache;
+import cc.kune.core.client.state.Session;
+import cc.kune.core.client.state.StateManager;
+import cc.kune.core.shared.dto.AccessRolDTO;
+import cc.kune.core.shared.dto.StateContentDTO;
+import cc.kune.core.shared.i18n.I18nTranslationService;
+import cc.kune.gspace.client.viewers.ContentViewerPresenter;
+
+import com.google.inject.Inject;
+import com.google.inject.Provider;
+
+public class NewContentAction extends RolAction {
+
+ public static final String ID = "ctnnewid";
+ public static final String NEW_NAME = "ctnnewname";
+
+ private final ContentCache cache;
+ private final Provider<ContentServiceAsync> contentService;
+ private final ContentViewerPresenter contentViewer;
+ private final I18nTranslationService i18n;
+ private final Session session;
+ private final StateManager stateManager;
+
+ @Inject
+ public NewContentAction(final Session session, final StateManager stateManager,
+ final I18nTranslationService i18n, final Provider<ContentServiceAsync> contentService,
+ final ContentViewerPresenter contentViewerPresenter, final ContentCache cache) {
+ super(AccessRolDTO.Editor, true);
+ this.session = session;
+ this.stateManager = stateManager;
+ this.i18n = i18n;
+ this.contentService = contentService;
+ this.contentViewer = contentViewerPresenter;
+ this.cache = cache;
+ }
+
+ @Override
+ public void actionPerformed(final ActionEvent event) {
+ NotifyUser.showProgressProcessing();
+ // stateManager.gotoStateToken(((HasContent)
+ // session.getCurrentState()).getContainer().getStateToken());
+ final String newName = (String) getValue(NEW_NAME);
+ contentService.get().addContent(session.getUserHash(),
+ session.getCurrentStateToken().copy().clearDocument(), newName, (String) getValue(ID),
+ new AsyncCallbackSimple<StateContentDTO>() {
+ @Override
+ public void onSuccess(final StateContentDTO state) {
+ stateManager.setRetrievedStateAndGo(state);
+ NotifyUser.hideProgress();
+ // stateManager.refreshCurrentGroupState();
+ // contextNavigator.setEditOnNextStateChange(true);
+ NotifyUser.info(i18n.tWithNT("[%s] created", "New content created, for instance", newName));
+ contentViewer.blinkTitle();
+ }
+ });
+ cache.removeContent(session.getCurrentStateToken());
+ }
+}
Modified: trunk/src/main/java/cc/kune/gspace/client/actions/NewContentBtn.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/actions/NewContentBtn.java 2011-08-04 14:24:49 UTC (rev 1482)
+++ trunk/src/main/java/cc/kune/gspace/client/actions/NewContentBtn.java 2011-08-06 10:41:10 UTC (rev 1483)
@@ -19,85 +19,20 @@
*/
package cc.kune.gspace.client.actions;
-import cc.kune.common.client.actions.ActionEvent;
import cc.kune.common.client.actions.ui.descrip.ButtonDescriptor;
-import cc.kune.common.client.notify.NotifyUser;
import cc.kune.common.client.shortcuts.GlobalShortcutRegister;
-import cc.kune.core.client.actions.RolAction;
-import cc.kune.core.client.rpcservices.AsyncCallbackSimple;
-import cc.kune.core.client.rpcservices.ContentServiceAsync;
-import cc.kune.core.client.state.ContentCache;
-import cc.kune.core.client.state.Session;
-import cc.kune.core.client.state.StateManager;
-import cc.kune.core.shared.dto.AccessRolDTO;
-import cc.kune.core.shared.dto.HasContent;
-import cc.kune.core.shared.dto.StateContentDTO;
import cc.kune.core.shared.i18n.I18nTranslationService;
-import cc.kune.gspace.client.viewers.ContentViewerPresenter;
import com.google.gwt.resources.client.ImageResource;
-import com.google.inject.Inject;
-import com.google.inject.Provider;
public abstract class NewContentBtn extends ButtonDescriptor {
- public static class NewContentAction extends RolAction {
-
- private final ContentCache cache;
- private final Provider<ContentServiceAsync> contentService;
- private final ContentViewerPresenter contentViewer;
- private final I18nTranslationService i18n;
- private final Session session;
- private final StateManager stateManager;
-
- @Inject
- public NewContentAction(final Session session, final StateManager stateManager,
- final I18nTranslationService i18n, final Provider<ContentServiceAsync> contentService,
- final ContentViewerPresenter contentViewerPresenter, final ContentCache cache) {
- super(AccessRolDTO.Editor, true);
- this.session = session;
- this.stateManager = stateManager;
- this.i18n = i18n;
- this.contentService = contentService;
- this.contentViewer = contentViewerPresenter;
- this.cache = cache;
- }
-
- @Override
- public void actionPerformed(final ActionEvent event) {
- NotifyUser.showProgressProcessing();
- stateManager.gotoStateToken(((HasContent) session.getCurrentState()).getContainer().getStateToken());
- final String newName = (String) getValue(NEW_NAME);
- contentService.get().addContent(session.getUserHash(), session.getCurrentStateToken(), newName,
- (String) getValue(ID), new AsyncCallbackSimple<StateContentDTO>() {
- @Override
- public void onSuccess(final StateContentDTO state) {
- stateManager.setRetrievedStateAndGo(state);
- NotifyUser.hideProgress();
- // stateManager.refreshCurrentGroupState();
- // contextNavigator.setEditOnNextStateChange(true);
- NotifyUser.info(i18n.tWithNT("[%s] created", "New content created, for instance", newName));
- contentViewer.blinkTitle();
- }
- });
- cache.removeContent(session.getCurrentStateToken());
- }
- }
-
- private static final String ID = "ctnnewid";
- private static final String NEW_NAME = "ctnnewname";
-
public NewContentBtn(final I18nTranslationService i18n, final NewContentAction action,
final ImageResource icon, final GlobalShortcutRegister shorcutReg, final String title,
final String tooltip, final String newName, final String id) {
super(action);
- // The name given to this new content
- action.putValue(NEW_NAME, newName);
- action.putValue(ID, id);
- // final KeyStroke shortcut = Shortcut.getShortcut(false, true, false,
- // false, Character.valueOf('N'));
- // shorcutReg.put(shortcut, action);
+ action.putValue(NewContentAction.NEW_NAME, newName);
+ action.putValue(NewContentAction.ID, id);
this.withText(title).withToolTip(tooltip).withIcon(icon).withStyles("k-def-docbtn, k-fl");
}
-
}
Modified: trunk/src/main/java/cc/kune/gspace/client/actions/NewContentMenuItem.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/actions/NewContentMenuItem.java 2011-08-04 14:24:49 UTC (rev 1482)
+++ trunk/src/main/java/cc/kune/gspace/client/actions/NewContentMenuItem.java 2011-08-06 10:41:10 UTC (rev 1483)
@@ -21,82 +21,22 @@
import javax.annotation.Nonnull;
-import cc.kune.common.client.actions.ActionEvent;
import cc.kune.common.client.actions.ui.descrip.MenuDescriptor;
import cc.kune.common.client.actions.ui.descrip.MenuItemDescriptor;
-import cc.kune.common.client.notify.NotifyUser;
import cc.kune.common.client.shortcuts.GlobalShortcutRegister;
-import cc.kune.core.client.actions.RolAction;
-import cc.kune.core.client.rpcservices.AsyncCallbackSimple;
-import cc.kune.core.client.rpcservices.ContentServiceAsync;
-import cc.kune.core.client.state.ContentCache;
-import cc.kune.core.client.state.Session;
-import cc.kune.core.client.state.StateManager;
-import cc.kune.core.shared.dto.AccessRolDTO;
-import cc.kune.core.shared.dto.HasContent;
-import cc.kune.core.shared.dto.StateContentDTO;
import cc.kune.core.shared.i18n.I18nTranslationService;
-import cc.kune.gspace.client.viewers.ContentViewerPresenter;
import com.google.gwt.resources.client.ImageResource;
-import com.google.inject.Inject;
-import com.google.inject.Provider;
public class NewContentMenuItem extends MenuItemDescriptor {
- public static class NewContentAction extends RolAction {
-
- private final ContentCache cache;
- private final Provider<ContentServiceAsync> contentService;
- private final ContentViewerPresenter contentViewer;
- private final I18nTranslationService i18n;
- private final Session session;
- private final StateManager stateManager;
-
- @Inject
- public NewContentAction(final Session session, final StateManager stateManager,
- final I18nTranslationService i18n, final Provider<ContentServiceAsync> contentService,
- final ContentViewerPresenter contentViewerPresenter, final ContentCache cache) {
- super(AccessRolDTO.Editor, true);
- this.session = session;
- this.stateManager = stateManager;
- this.i18n = i18n;
- this.contentService = contentService;
- this.contentViewer = contentViewerPresenter;
- this.cache = cache;
- }
-
- @Override
- public void actionPerformed(final ActionEvent event) {
- NotifyUser.showProgressProcessing();
- stateManager.gotoStateToken(((HasContent) session.getCurrentState()).getContainer().getStateToken());
- final String newName = (String) getValue(NEW_NAME);
- contentService.get().addContent(session.getUserHash(), session.getCurrentStateToken(), newName,
- (String) getValue(ID), new AsyncCallbackSimple<StateContentDTO>() {
- @Override
- public void onSuccess(final StateContentDTO state) {
- stateManager.setRetrievedStateAndGo(state);
- NotifyUser.hideProgress();
- // stateManager.refreshCurrentGroupState();
- // contextNavigator.setEditOnNextStateChange(true);
- NotifyUser.info(i18n.tWithNT("[%s] created", "New content created, for instance", newName));
- contentViewer.blinkTitle();
- }
- });
- cache.removeContent(session.getCurrentStateToken());
- }
- }
-
- private static final String ID = "ctnnewid";
- private static final String NEW_NAME = "ctnnewname";
-
public NewContentMenuItem(final I18nTranslationService i18n, final NewContentAction action,
final ImageResource icon, final GlobalShortcutRegister shorcutReg, final String title,
final String tooltip, final String newName, final String id, @Nonnull final MenuDescriptor parent) {
super(parent, false, action);
// The name given to this new content
- action.putValue(NEW_NAME, newName);
- action.putValue(ID, id);
+ action.putValue(NewContentAction.NEW_NAME, newName);
+ action.putValue(NewContentAction.ID, id);
// final KeyStroke shortcut = Shortcut.getShortcut(false, true, false,
// false, Character.valueOf('N'));
// shorcutReg.put(shortcut, action);
Modified: trunk/src/main/java/cc/kune/gspace/client/viewers/ContentViewerPresenter.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/viewers/ContentViewerPresenter.java 2011-08-04 14:24:49 UTC (rev 1482)
+++ trunk/src/main/java/cc/kune/gspace/client/viewers/ContentViewerPresenter.java 2011-08-06 10:41:10 UTC (rev 1483)
@@ -22,8 +22,6 @@
import javax.annotation.Nonnull;
import cc.kune.common.client.actions.ui.descrip.GuiActionDescCollection;
-import cc.kune.common.client.actions.ui.descrip.GuiActionDescrip;
-import cc.kune.common.client.actions.ui.descrip.HasChilds;
import cc.kune.common.client.errors.UIException;
import cc.kune.common.client.ui.EditEvent;
import cc.kune.common.client.ui.EditEvent.EditHandler;
@@ -88,17 +86,19 @@
private final ActionRegistryByType actionsRegistry;
private HandlerRegistration editHandler;
+ private final PathToolbarUtils pathToolbarUtils;
private final Provider<RenameAction> renameAction;
private final Session session;
@Inject
public ContentViewerPresenter(final EventBus eventBus, final ContentViewerView view,
final ContentViewerProxy proxy, final Session session, final ActionRegistryByType actionsRegistry,
- final Provider<RenameAction> renameAction) {
+ final Provider<RenameAction> renameAction, final PathToolbarUtils pathToolbarUtils) {
super(eventBus, view, proxy);
this.session = session;
this.actionsRegistry = actionsRegistry;
this.renameAction = renameAction;
+ this.pathToolbarUtils = pathToolbarUtils;
session.onUserSignOut(true, new UserSignOutHandler() {
@Override
public void onUserSignOut(final UserSignOutEvent event) {
@@ -190,14 +190,7 @@
}
final GuiActionDescCollection actions = actionsRegistry.getCurrentActions(stateContent.getGroup(),
stateContent.getTypeId(), session.isLogged(), rights, ActionGroups.TOOLBAR);
- final GuiActionDescCollection actionsToAttach = new GuiActionDescCollection();
- for (final GuiActionDescrip action : actions) {
- // The previous actionsRegistry creates childs actions already via
- // Provider.get()
- if (action instanceof HasChilds) {
- actionsToAttach.add(action);
- }
- }
- getView().setActions(actionsToAttach);
+ pathToolbarUtils.createPath(stateContent.getContainer(), actions, true);
+ getView().setActions(actions);
}
}
\ No newline at end of file
Modified: trunk/src/main/java/cc/kune/gspace/client/viewers/FolderViewerPresenter.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/viewers/FolderViewerPresenter.java 2011-08-04 14:24:49 UTC (rev 1482)
+++ trunk/src/main/java/cc/kune/gspace/client/viewers/FolderViewerPresenter.java 2011-08-06 10:41:10 UTC (rev 1483)
@@ -21,13 +21,11 @@
import javax.annotation.Nonnull;
-import cc.kune.common.client.actions.ui.descrip.ButtonDescriptor;
import cc.kune.common.client.actions.ui.descrip.GuiActionDescCollection;
import cc.kune.common.client.ui.EditEvent;
import cc.kune.common.client.ui.EditEvent.EditHandler;
import cc.kune.common.client.ui.HasEditHandler;
import cc.kune.core.client.actions.ActionRegistryByType;
-import cc.kune.core.client.dnd.FolderViewerDropController;
import cc.kune.core.client.registry.ContentCapabilitiesRegistry;
import cc.kune.core.client.registry.IconsRegistry;
import cc.kune.core.client.services.FileDownloadUtils;
@@ -46,7 +44,6 @@
import cc.kune.core.shared.dto.StateContainerDTO;
import cc.kune.core.shared.i18n.I18nTranslationService;
import cc.kune.gspace.client.actions.ActionGroups;
-import cc.kune.gspace.client.actions.GotoTokenAction;
import cc.kune.gspace.client.actions.RenameAction;
import cc.kune.gspace.client.actions.RenameListener;
import cc.kune.gspace.client.tool.ContentViewer;
@@ -101,20 +98,13 @@
void showEmptyMsg(String contentTypeId);
}
- protected static final String CSSBTN = "k-button, k-fr";
- protected static final String CSSBTNC = "k-button, k-button-center, k-fr";
- protected static final String CSSBTNL = "k-button, k-button-left, k-fr";
- protected static final String CSSBTNR = "k-button, k-button-right, k-fr";
-
private final ActionRegistryByType actionsRegistry;
-
private final ContentCapabilitiesRegistry capabilitiesRegistry;
-
private final Provider<FileDownloadUtils> downloadUtilsProvider;
- private final Provider<FolderViewerDropController> dropController;
private HandlerRegistration editHandler;
private final I18nTranslationService i18n;
private final IconsRegistry iconsRegistry;
+ private final PathToolbarUtils pathToolbarUtils;
private final Provider<RenameAction> renameAction;
private final Session session;
private final StateManager stateManager;
@@ -126,7 +116,7 @@
final I18nTranslationService i18n, final ActionRegistryByType actionsRegistry,
final Provider<FileDownloadUtils> downloadUtilsProvider,
final Provider<RenameAction> renameAction, final ContentCapabilitiesRegistry capabilitiesRegistry,
- final Provider<FolderViewerDropController> dropController) {
+ final PathToolbarUtils pathToolbarUtils) {
super(eventBus, view, proxy);
this.session = session;
this.stateManager = stateManager;
@@ -134,7 +124,7 @@
this.actionsRegistry = actionsRegistry;
this.downloadUtilsProvider = downloadUtilsProvider;
this.capabilitiesRegistry = capabilitiesRegistry;
- this.dropController = dropController;
+ this.pathToolbarUtils = pathToolbarUtils;
iconsRegistry = capabilitiesRegistry.getIconsRegistry();
useGenericImageIcon = false;
this.renameAction = renameAction;
@@ -180,19 +170,6 @@
}
}
- String calculateStyle(final int pos, final int length) {
- if (length == 1) {
- return CSSBTN;
- }
- if (pos == 0) {
- return CSSBTNL;
- }
- if (pos == length - 1) {
- return CSSBTNR;
- }
- return CSSBTNC;
- }
-
private void createChildItems(final ContainerDTO container, final AccessRights containerRights) {
if (container.getContents().size() + container.getChilds().size() == 0) {
getView().showEmptyMsg(container.getTypeId());
@@ -233,32 +210,6 @@
});
}
- private void createPath(final ContainerDTO container, final GuiActionDescCollection actions) {
- final ContainerSimpleDTO[] path = container.getAbsolutePath();
- final int pathLength = path.length;
- if (pathLength > 0) {
- for (int i = pathLength - 1; i >= 0; i--) {
- final ButtonDescriptor btn = createPathButton(path[i], pathLength, i);
- if (i != pathLength - 1) {
- final FolderViewerDropController dropTarget = dropController.get();
- dropTarget.setTarget(path[i].getStateToken());
- btn.setDropTarget(dropTarget);
- }
- actions.add(btn);
- }
- }
-
- }
-
- private ButtonDescriptor createPathButton(final ContainerSimpleDTO container, final int length,
- final int pos) {
- final String style = calculateStyle(pos, length);
- final ButtonDescriptor btn = new ButtonDescriptor(new GotoTokenAction(
- iconsRegistry.getContentTypeIcon(container.getTypeId()), container.getName(),
- container.getStateToken(), style, stateManager, getEventBus()));
- return btn;
- }
-
@Override
public void detach() {
getView().detach();
@@ -312,7 +263,7 @@
final GuiActionDescCollection actions = actionsRegistry.getCurrentActions(stateContainer.getGroup(),
stateContainer.getTypeId(), session.isLogged(), rights, ActionGroups.TOOLBAR);
final ContainerDTO container = stateContainer.getContainer();
- createPath(container, actions);
+ pathToolbarUtils.createPath(container, actions, true);
getView().setActions(actions);
createChildItems(container, stateContainer.getContainerRights());
}
Added: trunk/src/main/java/cc/kune/gspace/client/viewers/PathToolbarUtils.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/viewers/PathToolbarUtils.java (rev 0)
+++ trunk/src/main/java/cc/kune/gspace/client/viewers/PathToolbarUtils.java 2011-08-06 10:41:10 UTC (rev 1483)
@@ -0,0 +1,79 @@
+package cc.kune.gspace.client.viewers;
+
+import cc.kune.common.client.actions.ui.descrip.ButtonDescriptor;
+import cc.kune.common.client.actions.ui.descrip.GuiActionDescCollection;
+import cc.kune.core.client.dnd.FolderViewerDropController;
+import cc.kune.core.client.registry.ContentCapabilitiesRegistry;
+import cc.kune.core.client.registry.IconsRegistry;
+import cc.kune.core.client.state.StateManager;
+import cc.kune.core.shared.dto.ContainerDTO;
+import cc.kune.core.shared.dto.ContainerSimpleDTO;
+import cc.kune.gspace.client.actions.GotoTokenAction;
+
+import com.google.gwt.event.shared.EventBus;
+import com.google.inject.Inject;
+import com.google.inject.Provider;
+
+public class PathToolbarUtils {
+
+ protected static final String CSSBTN = "k-button, k-fr";
+ protected static final String CSSBTNC = "k-button, k-button-center, k-fr";
+ protected static final String CSSBTNL = "k-button, k-button-left, k-fr";
+ protected static final String CSSBTNR = "k-button, k-button-right, k-fr";
+
+ private final Provider<FolderViewerDropController> dropController;
+ private final EventBus eventBus;
+ private final IconsRegistry iconsRegistry;
+ private final StateManager stateManager;
+
+ @Inject
+ public PathToolbarUtils(final Provider<FolderViewerDropController> dropController,
+ final StateManager stateManager, final ContentCapabilitiesRegistry capabilitiesRegistry,
+ final EventBus eventBus) {
+ this.dropController = dropController;
+ this.stateManager = stateManager;
+ this.eventBus = eventBus;
+ iconsRegistry = capabilitiesRegistry.getIconsRegistry();
+ }
+
+ String calculateStyle(final int pos, final int length) {
+ if (length == 1) {
+ return CSSBTN;
+ }
+ if (pos == 0) {
+ return CSSBTNL;
+ }
+ if (pos == length - 1) {
+ return CSSBTNR;
+ }
+ return CSSBTNC;
+ }
+
+ public void createPath(final ContainerDTO container, final GuiActionDescCollection actions,
+ final boolean withDrop) {
+ final ContainerSimpleDTO[] path = container.getAbsolutePath();
+ final int pathLength = path.length;
+ if (pathLength > 0) {
+ for (int i = pathLength - 1; i >= 0; i--) {
+ final ButtonDescriptor btn = createPathButton(path[i], pathLength, i);
+ if (withDrop) {
+ if (i != pathLength - 1) {
+ final FolderViewerDropController dropTarget = dropController.get();
+ dropTarget.setTarget(path[i].getStateToken());
+ btn.setDropTarget(dropTarget);
+ }
+ }
+ actions.add(btn);
+ }
+ }
+ }
+
+ private ButtonDescriptor createPathButton(final ContainerSimpleDTO container, final int length,
+ final int pos) {
+ final String style = calculateStyle(pos, length);
+ final ButtonDescriptor btn = new ButtonDescriptor(new GotoTokenAction(
+ iconsRegistry.getContentTypeIcon(container.getTypeId()), container.getName(),
+ container.getStateToken(), style, stateManager, eventBus));
+ return btn;
+ }
+}
Modified: trunk/src/main/java/cc/kune/meets/client/actions/GoParentFolderBtn.java
===================================================================
--- trunk/src/main/java/cc/kune/meets/client/actions/GoParentFolderBtn.java 2011-08-04 14:24:49 UTC (rev 1482)
+++ trunk/src/main/java/cc/kune/meets/client/actions/GoParentFolderBtn.java 2011-08-06 10:41:10 UTC (rev 1483)
@@ -20,17 +20,19 @@
package cc.kune.meets.client.actions;
import cc.kune.core.client.resources.CoreResources;
+import cc.kune.core.client.state.Session;
import cc.kune.core.shared.i18n.I18nTranslationService;
import cc.kune.gspace.client.actions.GoParentContainerBtn;
+import cc.kune.meets.shared.MeetingsConstants;
import com.google.inject.Inject;
public class GoParentFolderBtn extends GoParentContainerBtn {
- @Inject
- public GoParentFolderBtn(final I18nTranslationService i18n, final GoParentContainerAction action,
- final CoreResources res) {
- super(i18n, action, res);
- }
+ @Inject
+ public GoParentFolderBtn(final I18nTranslationService i18n, final GoParentContainerAction action,
+ final CoreResources res, final Session session) {
+ super(i18n, action, res, session, MeetingsConstants.TYPE_ROOT);
+ }
}
Modified: trunk/src/main/java/cc/kune/meets/client/actions/MeetingsClientActions.java
===================================================================
--- trunk/src/main/java/cc/kune/meets/client/actions/MeetingsClientActions.java 2011-08-04 14:24:49 UTC (rev 1482)
+++ trunk/src/main/java/cc/kune/meets/client/actions/MeetingsClientActions.java 2011-08-06 10:41:10 UTC (rev 1483)
@@ -55,7 +55,7 @@
actionsRegistry.addAction(ActionGroups.TOOLBAR, refresh, all);
actionsRegistry.addAction(ActionGroups.TOOLBAR, newMeetingsBtn, containers);
actionsRegistry.addAction(ActionGroups.TOOLBAR, participateBtn, contents);
- actionsRegistry.addAction(ActionGroups.TOOLBAR, folderGoUp, contents);
+ actionsRegistry.addAction(ActionGroups.TOOLBAR, folderGoUp, all);
actionsRegistry.addAction(ActionGroups.ITEM_MENU, openContentMenuItem, contents);
actionsRegistry.addAction(ActionGroups.ITEM_MENU, openContentMenuItem, containersNoRoot);
actionsRegistry.addAction(ActionGroups.ITEM_MENU, delContentMenuItem, contents);
Modified: trunk/src/main/java/cc/kune/meets/client/actions/NewMeetingsBtn.java
===================================================================
--- trunk/src/main/java/cc/kune/meets/client/actions/NewMeetingsBtn.java 2011-08-04 14:24:49 UTC (rev 1482)
+++ trunk/src/main/java/cc/kune/meets/client/actions/NewMeetingsBtn.java 2011-08-06 10:41:10 UTC (rev 1483)
@@ -22,6 +22,7 @@
import cc.kune.common.client.shortcuts.GlobalShortcutRegister;
import cc.kune.core.client.resources.nav.NavResources;
import cc.kune.core.shared.i18n.I18nTranslationService;
+import cc.kune.gspace.client.actions.NewContentAction;
import cc.kune.gspace.client.actions.NewContentBtn;
import cc.kune.meets.shared.MeetingsConstants;
Modified: trunk/src/main/java/cc/kune/wiki/client/actions/GoParentFolderBtn.java
===================================================================
--- trunk/src/main/java/cc/kune/wiki/client/actions/GoParentFolderBtn.java 2011-08-04 14:24:49 UTC (rev 1482)
+++ trunk/src/main/java/cc/kune/wiki/client/actions/GoParentFolderBtn.java 2011-08-06 10:41:10 UTC (rev 1483)
@@ -20,16 +20,19 @@
package cc.kune.wiki.client.actions;
import cc.kune.core.client.resources.CoreResources;
+import cc.kune.core.client.state.Session;
import cc.kune.core.shared.i18n.I18nTranslationService;
import cc.kune.gspace.client.actions.GoParentContainerBtn;
+import cc.kune.wiki.shared.WikiConstants;
import com.google.inject.Inject;
public class GoParentFolderBtn extends GoParentContainerBtn {
- @Inject
- public GoParentFolderBtn(final I18nTranslationService i18n, final GoParentContainerAction action, final CoreResources res) {
- super(i18n, action, res);
- }
+ @Inject
+ public GoParentFolderBtn(final I18nTranslationService i18n, final GoParentContainerAction action,
+ final CoreResources res, final Session session) {
+ super(i18n, action, res, session, WikiConstants.TYPE_ROOT);
+ }
}
Deleted: trunk/src/main/java/cc/kune/wiki/client/actions/NewWikiBtn.java
===================================================================
--- trunk/src/main/java/cc/kune/wiki/client/actions/NewWikiBtn.java 2011-08-04 14:24:49 UTC (rev 1482)
+++ trunk/src/main/java/cc/kune/wiki/client/actions/NewWikiBtn.java 2011-08-06 10:41:10 UTC (rev 1483)
@@ -1,42 +0,0 @@
-/*
- *
- * Copyright (C) 2007-2011 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 cc.kune.wiki.client.actions;
-
-import cc.kune.common.client.shortcuts.GlobalShortcutRegister;
-import cc.kune.core.client.resources.nav.NavResources;
-import cc.kune.core.shared.i18n.I18nTranslationService;
-import cc.kune.gspace.client.actions.NewContentMenuItem;
-import cc.kune.wiki.shared.WikiConstants;
-
-import com.google.inject.Inject;
-
-public class NewWikiBtn extends NewContentMenuItem {
-
- @Inject
- public NewWikiBtn(final I18nTranslationService i18n, final NewContentAction action,
- final NavResources res, final GlobalShortcutRegister shorcutReg,
- final WikiFolderNewMenu wikiFolderNewMenu) {
- super(i18n, action, res.wikipageAdd(), shorcutReg, i18n.t("New wikipage"),
- i18n.t("Create a New Wikipage here. "
- + "This document will be a new 'Page' in the public web if you publish it"),
- i18n.t("New wikipage"), WikiConstants.TYPE_WIKIPAGE, wikiFolderNewMenu.get());
- }
-
-}
Added: trunk/src/main/java/cc/kune/wiki/client/actions/NewWikiIconBtn.java
===================================================================
--- trunk/src/main/java/cc/kune/wiki/client/actions/NewWikiIconBtn.java (rev 0)
+++ trunk/src/main/java/cc/kune/wiki/client/actions/NewWikiIconBtn.java 2011-08-06 10:41:10 UTC (rev 1483)
@@ -0,0 +1,42 @@
+/*
+ *
+ * Copyright (C) 2007-2011 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 cc.kune.wiki.client.actions;
+
+import cc.kune.common.client.shortcuts.GlobalShortcutRegister;
+import cc.kune.core.client.resources.nav.NavResources;
+import cc.kune.core.shared.i18n.I18nTranslationService;
+import cc.kune.gspace.client.actions.NewContentAction;
+import cc.kune.gspace.client.actions.NewContentBtn;
+import cc.kune.wiki.shared.WikiConstants;
+
+import com.google.inject.Inject;
+
+public class NewWikiIconBtn extends NewContentBtn {
+
+ @Inject
+ public NewWikiIconBtn(final I18nTranslationService i18n, final NewContentAction action,
+ final NavResources res, final GlobalShortcutRegister shorcutReg) {
+ super(i18n, action, res.wikipageAdd(), shorcutReg, "", i18n.t("Create a New Wikipage here. "
+ + "This document will be a new 'Page' in the public web if you publish it"),
+ i18n.t("New wikipage"), WikiConstants.TYPE_WIKIPAGE);
+ withStyles("k-btn-min, k-fl");
+ }
+
+}
Copied: trunk/src/main/java/cc/kune/wiki/client/actions/NewWikiMenuItem.java (from rev 1481, trunk/src/main/java/cc/kune/wiki/client/actions/NewWikiBtn.java)
===================================================================
--- trunk/src/main/java/cc/kune/wiki/client/actions/NewWikiMenuItem.java (rev 0)
+++ trunk/src/main/java/cc/kune/wiki/client/actions/NewWikiMenuItem.java 2011-08-06 10:41:10 UTC (rev 1483)
@@ -0,0 +1,43 @@
+/*
+ *
+ * Copyright (C) 2007-2011 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 cc.kune.wiki.client.actions;
+
+import cc.kune.common.client.shortcuts.GlobalShortcutRegister;
+import cc.kune.core.client.resources.nav.NavResources;
+import cc.kune.core.shared.i18n.I18nTranslationService;
+import cc.kune.gspace.client.actions.NewContentAction;
+import cc.kune.gspace.client.actions.NewContentMenuItem;
+import cc.kune.wiki.shared.WikiConstants;
+
+import com.google.inject.Inject;
+
+public class NewWikiMenuItem extends NewContentMenuItem {
+
+ @Inject
+ public NewWikiMenuItem(final I18nTranslationService i18n, final NewContentAction action,
+ final NavResources res, final GlobalShortcutRegister shorcutReg,
+ final WikiFolderNewMenu wikiFolderNewMenu) {
+ super(i18n, action, res.wikipageAdd(), shorcutReg, i18n.t("New wikipage"),
+ i18n.t("Create a New Wikipage here. "
+ + "This document will be a new 'Page' in the public web if you publish it"),
+ i18n.t("New wikipage"), WikiConstants.TYPE_WIKIPAGE, wikiFolderNewMenu.get());
+ }
+
+}
Modified: trunk/src/main/java/cc/kune/wiki/client/actions/WikiClientActions.java
===================================================================
--- trunk/src/main/java/cc/kune/wiki/client/actions/WikiClientActions.java 2011-08-04 14:24:49 UTC (rev 1482)
+++ trunk/src/main/java/cc/kune/wiki/client/actions/WikiClientActions.java 2011-08-06 10:41:10 UTC (rev 1483)
@@ -50,8 +50,9 @@
@Inject
public WikiClientActions(final I18nUITranslationService i18n, final Session session,
final StateManager stateManager, final ActionRegistryByType registry, final CoreResources res,
- final Provider<GoParentFolderBtn> folderGoUp, final Provider<NewWikiBtn> newWikiBtn,
- final Provider<NewFolderBtn> newFolderBtn, final Provider<OpenWikiMenuItem> openContentMenuItem,
+ final Provider<GoParentFolderBtn> folderGoUp, final Provider<NewWikiMenuItem> newWikiMenuItem,
+ final Provider<NewWikiIconBtn> newWikiIconBtn, final Provider<NewFolderBtn> newFolderBtn,
+ final Provider<OpenWikiMenuItem> openContentMenuItem,
final Provider<DelWikiMenuItem> delContentMenuItem,
final Provider<ContentViewerOptionsMenu> optionsMenuContent,
final Provider<ParticipateInContentBtn> participateBtn,
@@ -63,11 +64,12 @@
actionsRegistry.addAction(ActionGroups.TOOLBAR, optionsMenuContent, all);
actionsRegistry.addAction(ActionGroups.TOOLBAR, folderNewMenu, containers);
actionsRegistry.addAction(ActionGroups.TOOLBAR, refresh, all);
+ actionsRegistry.addAction(ActionGroups.TOOLBAR, newWikiMenuItem, containers);
+ actionsRegistry.addAction(ActionGroups.TOOLBAR, newWikiIconBtn, all);
+ actionsRegistry.addAction(ActionGroups.TOOLBAR, newFolderBtn, containers);
actionsRegistry.addAction(ActionGroups.TOOLBAR, folderGoUp, contents);
- actionsRegistry.addAction(ActionGroups.TOOLBAR, folderGoUp, containersNoRoot);
- actionsRegistry.addAction(ActionGroups.TOOLBAR, newWikiBtn, containers);
+ actionsRegistry.addAction(ActionGroups.TOOLBAR, folderGoUp, containers);
actionsRegistry.addAction(ActionGroups.TOOLBAR, participateBtn, contents);
- actionsRegistry.addAction(ActionGroups.TOOLBAR, newFolderBtn, containers);
actionsRegistry.addAction(ActionGroups.TOOLBAR, chatAbout, contents);
actionsRegistry.addAction(ActionGroups.ITEM_MENU, openContentMenuItem, contents);
actionsRegistry.addAction(ActionGroups.ITEM_MENU, openContentMenuItem, containersNoRoot);
Modified: trunk/src/test/java/cc/kune/gspace/client/viewers/FolderViewerPresenterTest.java
===================================================================
--- trunk/src/test/java/cc/kune/gspace/client/viewers/FolderViewerPresenterTest.java 2011-08-04 14:24:49 UTC (rev 1482)
+++ trunk/src/test/java/cc/kune/gspace/client/viewers/FolderViewerPresenterTest.java 2011-08-06 10:41:10 UTC (rev 1483)
@@ -19,10 +19,10 @@
*/
package cc.kune.gspace.client.viewers;
-import static cc.kune.gspace.client.viewers.FolderViewerPresenter.CSSBTN;
-import static cc.kune.gspace.client.viewers.FolderViewerPresenter.CSSBTNC;
-import static cc.kune.gspace.client.viewers.FolderViewerPresenter.CSSBTNL;
-import static cc.kune.gspace.client.viewers.FolderViewerPresenter.CSSBTNR;
+import static cc.kune.gspace.client.viewers.PathToolbarUtils.CSSBTN;
+import static cc.kune.gspace.client.viewers.PathToolbarUtils.CSSBTNC;
+import static cc.kune.gspace.client.viewers.PathToolbarUtils.CSSBTNL;
+import static cc.kune.gspace.client.viewers.PathToolbarUtils.CSSBTNR;
import static org.junit.Assert.assertEquals;
import org.junit.Before;
@@ -33,12 +33,11 @@
public class FolderViewerPresenterTest {
- private FolderViewerPresenter presenter;
+ private PathToolbarUtils presenter;
@Before
public void before() {
- presenter = new FolderViewerPresenter(null, null, null, null, null, null, null, null, null,
- Mockito.mock(ContentCapabilitiesRegistry.class), null);
+ presenter = new PathToolbarUtils(null, null, Mockito.mock(ContentCapabilitiesRegistry.class), null);
}
@Test
More information about the kune-commits
mailing list