[kune-commits] r1349 - in trunk/src: main/java/cc/kune/blogs/client main/java/cc/kune/blogs/client/actions main/java/cc/kune/chat/client main/java/cc/kune/client main/java/cc/kune/common/client main/java/cc/kune/common/client/actions/gwtui main/java/cc/kune/core/client main/java/cc/kune/core/client/events main/java/cc/kune/core/public main/java/cc/kune/core/public/images main/java/cc/kune/core/public/images/ie6 main/java/cc/kune/docs/client main/java/cc/kune/docs/client/actions main/java/cc/kune/domain main/java/cc/kune/gspace/client main/java/cc/kune/gspace/client/actions main/java/cc/kune/gspace/client/options/logo main/java/cc/kune/gspace/client/resources main/java/cc/kune/gspace/client/viewers test/java/cc/kune/core/server/manager test/java/cc/kune/gspace/client test/java/cc/kune/gspace/client/viewers
Vicente J. Ruiz Jurado
vjrj_ at ourproject.org
Fri May 6 01:52:35 CEST 2011
Author: vjrj_
Date: 2011-05-06 01:52:34 +0200 (Fri, 06 May 2011)
New Revision: 1349
Added:
trunk/src/main/java/cc/kune/common/client/ExtendedGinModule.java
trunk/src/main/java/cc/kune/core/client/events/
trunk/src/main/java/cc/kune/core/client/events/AvatarChangedEvent.java
trunk/src/main/java/cc/kune/core/client/events/RenameContentEvent.java
trunk/src/main/java/cc/kune/core/public/images/ie6/
trunk/src/main/java/cc/kune/core/public/images/ie6/corner_dialog_topleft.png
trunk/src/main/java/cc/kune/core/public/images/ie6/corner_dialog_topright.png
trunk/src/main/java/cc/kune/core/public/images/ie6/hborder_blue_shadow.png
trunk/src/main/java/cc/kune/core/public/images/ie6/hborder_gray_shadow.png
trunk/src/main/java/cc/kune/core/public/images/ie6/vborder_blue_shadow.png
trunk/src/main/java/cc/kune/core/public/images/ie6/vborder_gray_shadow.png
trunk/src/main/java/cc/kune/gspace/client/actions/ContentViewerOptionsMenu.java
trunk/src/main/java/cc/kune/gspace/client/actions/GotoTokenAction.java
trunk/src/main/java/cc/kune/gspace/client/viewers/ContentViewerPanel.java
trunk/src/main/java/cc/kune/gspace/client/viewers/ContentViewerPanel.ui.xml
trunk/src/main/java/cc/kune/gspace/client/viewers/ContentViewerPresenter.java
trunk/src/test/java/cc/kune/gspace/client/viewers/
trunk/src/test/java/cc/kune/gspace/client/viewers/FolderViewerPresenterTest.java
Removed:
trunk/src/main/java/cc/kune/blogs/client/actions/ContentViewerOptionsMenu.java
trunk/src/main/java/cc/kune/client/ExtendedGinModule.java
trunk/src/main/java/cc/kune/gspace/client/viewers/DocViewerPanel.java
trunk/src/main/java/cc/kune/gspace/client/viewers/DocViewerPanel.ui.xml
trunk/src/main/java/cc/kune/gspace/client/viewers/DocViewerPresenter.java
Modified:
trunk/src/main/java/cc/kune/blogs/client/BlogsClientTool.java
trunk/src/main/java/cc/kune/blogs/client/BlogsParts.java
trunk/src/main/java/cc/kune/blogs/client/actions/BlogsClientActions.java
trunk/src/main/java/cc/kune/chat/client/ChatClientDefault.java
trunk/src/main/java/cc/kune/common/client/actions/gwtui/AbstractGwtButtonGui.java
trunk/src/main/java/cc/kune/common/client/actions/gwtui/GwtPushButtonGui.java
trunk/src/main/java/cc/kune/core/client/CoreGinModule.java
trunk/src/main/java/cc/kune/core/public/ws.css
trunk/src/main/java/cc/kune/docs/client/DocsClientTool.java
trunk/src/main/java/cc/kune/docs/client/DocsParts.java
trunk/src/main/java/cc/kune/docs/client/actions/DocsClientActions.java
trunk/src/main/java/cc/kune/domain/Container.java
trunk/src/main/java/cc/kune/gspace/client/GSpaceGinModule.java
trunk/src/main/java/cc/kune/gspace/client/GSpaceGinjector.java
trunk/src/main/java/cc/kune/gspace/client/GSpaceParts.java
trunk/src/main/java/cc/kune/gspace/client/actions/RefreshContentMenuItem.java
trunk/src/main/java/cc/kune/gspace/client/actions/RenameAction.java
trunk/src/main/java/cc/kune/gspace/client/options/logo/EntityOptionsLogoPresenter.java
trunk/src/main/java/cc/kune/gspace/client/options/logo/GroupOptionsLogoPresenter.java
trunk/src/main/java/cc/kune/gspace/client/options/logo/UserOptionsLogoPresenter.java
trunk/src/main/java/cc/kune/gspace/client/resources/wsArmor.css
trunk/src/main/java/cc/kune/gspace/client/viewers/FolderViewerPresenter.java
trunk/src/test/java/cc/kune/core/server/manager/ContentManagerTest.java
Log:
Folder navigator and some fixes
Modified: trunk/src/main/java/cc/kune/blogs/client/BlogsClientTool.java
===================================================================
--- trunk/src/main/java/cc/kune/blogs/client/BlogsClientTool.java 2011-05-05 21:20:17 UTC (rev 1348)
+++ trunk/src/main/java/cc/kune/blogs/client/BlogsClientTool.java 2011-05-05 23:52:34 UTC (rev 1349)
@@ -34,36 +34,37 @@
public class BlogsClientTool extends FoldableAbstractClientTool {
- private final NavResources navResources;
+ private final NavResources navResources;
- @Inject
- public BlogsClientTool(final I18nUITranslationService i18n, final ToolSelector toolSelector,
- final ContentCapabilitiesRegistry cntCapRegistry, final NavResources navResources) {
- super(NAME, i18n.t("blogs"), toolSelector, cntCapRegistry);
- this.navResources = navResources;
+ @Inject
+ public BlogsClientTool(final I18nUITranslationService i18n, final ToolSelector toolSelector,
+ final ContentCapabilitiesRegistry cntCapRegistry, final NavResources navResources) {
+ super(NAME, i18n.t("blogs"), toolSelector, cntCapRegistry);
+ this.navResources = navResources;
- // registerAclEditableTypes();
- registerAuthorableTypes(TYPE_POST, TYPE_UPLOADEDFILE);
- registerDragableTypes(TYPE_UPLOADEDFILE);
- registerDropableTypes(TYPE_ROOT);
- registerPublishModerableTypes(TYPE_POST, TYPE_UPLOADEDFILE);
- registerRateableTypes(TYPE_POST, TYPE_UPLOADEDFILE);
- registerRenamableTypes(TYPE_BLOG, TYPE_POST, TYPE_UPLOADEDFILE);
- registerTageableTypes(TYPE_BLOG, TYPE_UPLOADEDFILE, TYPE_POST);
- // registerTranslatableTypes();
+ // registerAclEditableTypes();
+ registerAuthorableTypes(TYPE_POST, TYPE_UPLOADEDFILE);
+ registerDragableTypes(TYPE_UPLOADEDFILE);
+ registerDropableTypes(TYPE_ROOT);
+ registerPublishModerableTypes(TYPE_POST, TYPE_UPLOADEDFILE);
+ registerRateableTypes(TYPE_POST, TYPE_UPLOADEDFILE);
+ registerRenamableTypes(TYPE_BLOG, TYPE_POST, TYPE_UPLOADEDFILE);
+ registerTageableTypes(TYPE_BLOG, TYPE_UPLOADEDFILE, TYPE_POST);
+ // registerTranslatableTypes();
- registerIcons();
- }
+ registerIcons();
+ }
- @Override
- public String getName() {
- return NAME;
- }
+ @Override
+ public String getName() {
+ return NAME;
+ }
- private void registerIcons() {
- registerContentTypeIcon(TYPE_BLOG, navResources.blog());
- registerContentTypeIcon(TYPE_POST, navResources.post());
- registerUploadTypesAndMimes(TYPE_UPLOADEDFILE);
- }
+ private void registerIcons() {
+ registerContentTypeIcon(TYPE_ROOT, navResources.blog());
+ registerContentTypeIcon(TYPE_BLOG, navResources.blog());
+ registerContentTypeIcon(TYPE_POST, navResources.post());
+ registerUploadTypesAndMimes(TYPE_UPLOADEDFILE);
+ }
}
Modified: trunk/src/main/java/cc/kune/blogs/client/BlogsParts.java
===================================================================
--- trunk/src/main/java/cc/kune/blogs/client/BlogsParts.java 2011-05-05 21:20:17 UTC (rev 1348)
+++ trunk/src/main/java/cc/kune/blogs/client/BlogsParts.java 2011-05-05 23:52:34 UTC (rev 1349)
@@ -1,14 +1,23 @@
package cc.kune.blogs.client;
+import cc.kune.blogs.client.actions.BlogsClientActions;
+import cc.kune.blogs.shared.BlogsConstants;
import cc.kune.core.client.state.Session;
+import cc.kune.gspace.client.tool.ContentViewerSelector;
+import cc.kune.gspace.client.viewers.ContentViewerPresenter;
+import cc.kune.gspace.client.viewers.FolderViewerPresenter;
import com.google.inject.Inject;
import com.google.inject.Provider;
public class BlogsParts {
- @Inject
- public BlogsParts(final Session session, final Provider<BlogsClientTool> clientTool) {
- clientTool.get();
- }
+ @Inject
+ public BlogsParts(final Session session, final Provider<BlogsClientTool> clientTool,
+ final ContentViewerSelector viewerSelector, final BlogsClientActions blogsActions,
+ final ContentViewerPresenter contentViewer, final FolderViewerPresenter folderViewer) {
+ clientTool.get();
+ viewerSelector.register(contentViewer, true, BlogsConstants.TYPE_POST);
+ viewerSelector.register(folderViewer, true, BlogsConstants.TYPE_ROOT, BlogsConstants.TYPE_BLOG);
+ }
}
\ No newline at end of file
Modified: trunk/src/main/java/cc/kune/blogs/client/actions/BlogsClientActions.java
===================================================================
--- trunk/src/main/java/cc/kune/blogs/client/actions/BlogsClientActions.java 2011-05-05 21:20:17 UTC (rev 1348)
+++ trunk/src/main/java/cc/kune/blogs/client/actions/BlogsClientActions.java 2011-05-05 23:52:34 UTC (rev 1349)
@@ -30,6 +30,7 @@
import cc.kune.core.client.state.StateManager;
import cc.kune.gspace.client.actions.AbstractFoldableToolActions;
import cc.kune.gspace.client.actions.ActionGroups;
+import cc.kune.gspace.client.actions.ContentViewerOptionsMenu;
import cc.kune.gspace.client.actions.ParticipateInContentBtn;
import cc.kune.gspace.client.actions.RefreshContentMenuItem;
import cc.kune.gspace.client.actions.SetAsHomePageMenuItem;
@@ -57,11 +58,11 @@
final Provider<DelBlogMenuItem> delFolderMenuItem,
final Provider<SetAsHomePageMenuItem> setAsHomePage) {
super(session, stateManager, i18n, registry);
+ actionsRegistry.addAction(ActionGroups.VIEW, optionsMenuContent, all);
+ actionsRegistry.addAction(ActionGroups.VIEW, refresh, all);
actionsRegistry.addAction(ActionGroups.VIEW, folderGoUp, contents);
actionsRegistry.addAction(ActionGroups.VIEW, folderGoUp, containersNoRoot);
- actionsRegistry.addAction(ActionGroups.VIEW, optionsMenuContent, all);
actionsRegistry.addAction(ActionGroups.VIEW, participateBtn, contents);
- actionsRegistry.addAction(ActionGroups.VIEW, refresh, all);
actionsRegistry.addAction(ActionGroups.VIEW, newDocBtn, containersNoRoot);
actionsRegistry.addAction(ActionGroups.VIEW, newFolderBtn, TYPE_ROOT);
actionsRegistry.addAction(ActionGroups.MENUITEM, openContentMenuItem, contents);
Deleted: trunk/src/main/java/cc/kune/blogs/client/actions/ContentViewerOptionsMenu.java
===================================================================
--- trunk/src/main/java/cc/kune/blogs/client/actions/ContentViewerOptionsMenu.java 2011-05-05 21:20:17 UTC (rev 1348)
+++ trunk/src/main/java/cc/kune/blogs/client/actions/ContentViewerOptionsMenu.java 2011-05-05 23:52:34 UTC (rev 1349)
@@ -1,16 +0,0 @@
-package cc.kune.blogs.client.actions;
-
-import cc.kune.common.client.actions.ui.descrip.MenuDescriptor;
-import cc.kune.core.client.resources.CoreResources;
-
-import com.google.inject.Inject;
-
-public class ContentViewerOptionsMenu extends MenuDescriptor {
-
- @Inject
- public ContentViewerOptionsMenu(final CoreResources res) {
- super();
- this.withIcon(res.arrowdownsitebar()).withStyles("k-def-docbtn, k-fr, k-noborder, k-nobackcolor");
- }
-
-}
Modified: trunk/src/main/java/cc/kune/chat/client/ChatClientDefault.java
===================================================================
--- trunk/src/main/java/cc/kune/chat/client/ChatClientDefault.java 2011-05-05 21:20:17 UTC (rev 1348)
+++ trunk/src/main/java/cc/kune/chat/client/ChatClientDefault.java 2011-05-05 23:52:34 UTC (rev 1349)
@@ -38,6 +38,7 @@
import cc.kune.common.client.shortcuts.GlobalShortcutRegister;
import cc.kune.common.client.utils.TextUtils;
import cc.kune.common.client.utils.WindowUtils;
+import cc.kune.core.client.events.AvatarChangedEvent;
import cc.kune.core.client.init.AppStartEvent;
import cc.kune.core.client.init.AppStopEvent;
import cc.kune.core.client.sitebar.SitebarActions;
@@ -80,371 +81,380 @@
public class ChatClientDefault implements ChatClient {
- public class ChatClientAction extends AbstractExtendedAction {
+ public class ChatClientAction extends AbstractExtendedAction {
- private final EventBus eventBus;
- private final ChatResources res;
+ private final EventBus eventBus;
+ private final ChatResources res;
- public ChatClientAction(final EventBus eventBus, final ChatResources res) {
- super();
- this.eventBus = eventBus;
- this.res = res;
- putValue(Action.SMALL_ICON, res.chat());
+ public ChatClientAction(final EventBus eventBus, final ChatResources res) {
+ super();
+ this.eventBus = eventBus;
+ this.res = res;
+ putValue(Action.SMALL_ICON, res.chat());
- }
+ }
- @Override
- public void actionPerformed(final ActionEvent event) {
- eventBus.fireEvent(new ToggleShowChatDialogEvent());
- }
+ @Override
+ public void actionPerformed(final ActionEvent event) {
+ eventBus.fireEvent(new ToggleShowChatDialogEvent());
+ }
- public void setBlink(final boolean blink) {
- final ImageResource icon = blink ? res.chatBlink() : res.chat();
- putValue(Action.SMALL_ICON, icon);
- dialog.setIcon(AbstractImagePrototype.create(icon));
- }
-
+ public void setBlink(final boolean blink) {
+ final ImageResource icon = blink ? res.chatBlink() : res.chat();
+ putValue(Action.SMALL_ICON, icon);
+ dialog.setIcon(AbstractImagePrototype.create(icon));
}
- protected static final String CHAT_CLIENT_ICON_ID = "k-chat-icon-id";
+ }
- private static final String CHAT_TITLE = "Chat ;)";
+ protected static final String CHAT_CLIENT_ICON_ID = "k-chat-icon-id";
- private final ChatClientAction action;
- protected IconLabelDescriptor chatIcon;
- private final ChatManager chatManager;
- private final ChatOptions chatOptions;
- private final ChatResources chatResources;
- private Dialog dialog;
- private final EventBus eventBus;
- private final I18nTranslationService i18n;
- private final RoomManager roomManager;
- private final XmppRoster roster;
- private final Session session;
- private final GlobalShortcutRegister shorcutRegister;
- private final SitebarActions siteActions;
+ private static final String CHAT_TITLE = "Chat ;)";
- private final XmppSession xmppSession;
+ private final ChatClientAction action;
+ protected IconLabelDescriptor chatIcon;
+ private final ChatManager chatManager;
+ private final ChatOptions chatOptions;
+ private final ChatResources chatResources;
+ private Dialog dialog;
+ private final EventBus eventBus;
+ private final I18nTranslationService i18n;
+ private final RoomManager roomManager;
+ private final XmppRoster roster;
+ private final Session session;
+ private final GlobalShortcutRegister shorcutRegister;
+ private final SitebarActions siteActions;
- @Inject
- public ChatClientDefault(final EventBus eventBus, final I18nTranslationService i18n,
- final SitebarActions siteActions, final Session session, final GlobalShortcutRegister shorcutRegister,
- final ChatOptions chatOptions, final ChatResources chatResources) {
+ private final XmppSession xmppSession;
- this.eventBus = eventBus;
- this.i18n = i18n;
- action = new ChatClientAction(eventBus, chatResources);
- this.siteActions = siteActions;
- this.session = session;
- this.shorcutRegister = shorcutRegister;
- this.chatOptions = chatOptions;
- this.chatResources = chatResources;
- chatResources.css().ensureInjected();
- this.xmppSession = Suco.get(XmppSession.class);
- this.roster = Suco.get(XmppRoster.class);
- this.chatManager = Suco.get(ChatManager.class);
- this.roomManager = Suco.get(RoomManager.class);
- Suco.get(SessionReconnect.class);
+ @Inject
+ public ChatClientDefault(final EventBus eventBus, final I18nTranslationService i18n,
+ final SitebarActions siteActions, final Session session,
+ final GlobalShortcutRegister shorcutRegister, final ChatOptions chatOptions,
+ final ChatResources chatResources) {
- session.onAppStart(true, new AppStartEvent.AppStartHandler() {
- @Override
- public void onAppStart(final AppStartEvent event) {
- chatOptions.domain = event.getInitData().getChatDomain();
- chatOptions.httpBase = event.getInitData().getChatHttpBase();
- chatOptions.roomHost = event.getInitData().getChatRoomHost();
- checkChatDomain(chatOptions.domain);
- session.onUserSignIn(true, new UserSignInHandler() {
- @Override
- public void onUserSignIn(final UserSignInEvent event) {
- doLogin();
- }
- });
- session.onUserSignOut(true, new UserSignOutHandler() {
- @Override
- public void onUserSignOut(final UserSignOutEvent event) {
- createActionIfNeeded();
- chatIcon.setVisible(false);
- logout();
- }
- });
- eventBus.addHandler(ShowChatDialogEvent.getType(), new ShowChatDialogHandler() {
- @Override
- public void onShowChatDialog(final ShowChatDialogEvent event) {
- createActionIfNeeded();
- showDialog(event.show);
- }
- });
- eventBus.addHandler(ToggleShowChatDialogEvent.getType(), new ToggleShowChatDialogHandler() {
- @Override
- public void onToggleShowChatDialog(final ToggleShowChatDialogEvent event) {
- toggleShowDialog();
- }
- });
- }
+ this.eventBus = eventBus;
+ this.i18n = i18n;
+ action = new ChatClientAction(eventBus, chatResources);
+ this.siteActions = siteActions;
+ this.session = session;
+ this.shorcutRegister = shorcutRegister;
+ this.chatOptions = chatOptions;
+ this.chatResources = chatResources;
+ chatResources.css().ensureInjected();
+ this.xmppSession = Suco.get(XmppSession.class);
+ this.roster = Suco.get(XmppRoster.class);
+ this.chatManager = Suco.get(ChatManager.class);
+ this.roomManager = Suco.get(RoomManager.class);
+ Suco.get(SessionReconnect.class);
+
+ session.onAppStart(true, new AppStartEvent.AppStartHandler() {
+ @Override
+ public void onAppStart(final AppStartEvent event) {
+ chatOptions.domain = event.getInitData().getChatDomain();
+ chatOptions.httpBase = event.getInitData().getChatHttpBase();
+ chatOptions.roomHost = event.getInitData().getChatRoomHost();
+ checkChatDomain(chatOptions.domain);
+ session.onUserSignIn(true, new UserSignInHandler() {
+ @Override
+ public void onUserSignIn(final UserSignInEvent event) {
+ doLogin();
+ }
});
- eventBus.addHandler(AppStopEvent.getType(), new AppStopEvent.AppStopHandler() {
- @Override
- public void onAppStop(final AppStopEvent event) {
- logout();
- }
+ session.onUserSignOut(true, new UserSignOutHandler() {
+ @Override
+ public void onUserSignOut(final UserSignOutEvent event) {
+ createActionIfNeeded();
+ chatIcon.setVisible(false);
+ logout();
+ }
});
- }
+ eventBus.addHandler(ShowChatDialogEvent.getType(), new ShowChatDialogHandler() {
+ @Override
+ public void onShowChatDialog(final ShowChatDialogEvent event) {
+ createActionIfNeeded();
+ showDialog(event.show);
+ }
+ });
+ eventBus.addHandler(ToggleShowChatDialogEvent.getType(), new ToggleShowChatDialogHandler() {
+ @Override
+ public void onToggleShowChatDialog(final ToggleShowChatDialogEvent event) {
+ toggleShowDialog();
+ }
+ });
+ eventBus.addHandler(AvatarChangedEvent.getType(), new AvatarChangedEvent.AvatarChangedHandler() {
- @Override
- public void addNewBuddie(final String shortName) {
- roster.requestAddItem(uriFrom(shortName), shortName, "");
- }
+ @Override
+ public void onAvatarChanged(final AvatarChangedEvent event) {
+ setAvatar(event.getPhotoBinary());
+ }
+ });
+ }
+ });
+ eventBus.addHandler(AppStopEvent.getType(), new AppStopEvent.AppStopHandler() {
+ @Override
+ public void onAppStop(final AppStopEvent event) {
+ logout();
+ }
+ });
+ }
- @Override
- public void chat(final String shortName) {
- chat(uriFrom(shortName));
- }
+ @Override
+ public void addNewBuddie(final String shortName) {
+ roster.requestAddItem(uriFrom(shortName), shortName, "");
+ }
- @Override
- public void chat(final XmppURI jid) {
- chatManager.open(jid);
- }
+ @Override
+ public void chat(final String shortName) {
+ chat(uriFrom(shortName));
+ }
- // Put this in Panel object
- 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 cause problems with the chat functionality. "
- + "Please check kune.properties on the server.");
- }
- }
+ @Override
+ public void chat(final XmppURI jid) {
+ chatManager.open(jid);
+ }
- private void createActionIfNeeded() {
- if (chatIcon == null) {
- chatIcon = new IconLabelDescriptor(action);
- chatIcon.setId(CHAT_CLIENT_ICON_ID);
- chatIcon.setStyles("k-no-backimage, k-btn-sitebar, k-chat-icon");
- chatIcon.putValue(Action.NAME, i18n.t(CHAT_TITLE));
- chatIcon.putValue(Action.SHORT_DESCRIPTION, i18n.t("Show/hide the chat window"));
- final KeyStroke shortcut = Shortcut.getShortcut(false, true, false, false, Character.valueOf('C'));
- shorcutRegister.put(shortcut, action);
- action.setShortcut(shortcut);
- chatIcon.setVisible(session.isLogged());
- siteActions.getLeftToolbar().add(
- new ToolbarSeparatorDescriptor(Type.spacer, SitebarActionsPresenter.LEFT_TOOLBAR));
- siteActions.getLeftToolbar().add(
- new ToolbarSeparatorDescriptor(Type.spacer, SitebarActionsPresenter.LEFT_TOOLBAR));
- siteActions.getLeftToolbar().add(
- new ToolbarSeparatorDescriptor(Type.spacer, SitebarActionsPresenter.LEFT_TOOLBAR));
- siteActions.getLeftToolbar().add(chatIcon);
- }
+ // Put this in Panel object
+ 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 cause problems with the chat functionality. "
+ + "Please check kune.properties on the server.");
}
+ }
- private void createDialog(final KuneHablarWidget widget, final HtmlConfig htmlConfig) {
- widget.addStyleName("k-chat-panel");
- setSize(widget, htmlConfig);
- dialog.add(widget);
+ private void createActionIfNeeded() {
+ if (chatIcon == null) {
+ chatIcon = new IconLabelDescriptor(action);
+ chatIcon.setId(CHAT_CLIENT_ICON_ID);
+ chatIcon.setStyles("k-no-backimage, k-btn-sitebar, k-chat-icon");
+ chatIcon.putValue(Action.NAME, i18n.t(CHAT_TITLE));
+ chatIcon.putValue(Action.SHORT_DESCRIPTION, i18n.t("Show/hide the chat window"));
+ final KeyStroke shortcut = Shortcut.getShortcut(false, true, false, false, Character.valueOf('C'));
+ shorcutRegister.put(shortcut, action);
+ action.setShortcut(shortcut);
+ chatIcon.setVisible(session.isLogged());
+ siteActions.getLeftToolbar().add(
+ new ToolbarSeparatorDescriptor(Type.spacer, SitebarActionsPresenter.LEFT_TOOLBAR));
+ siteActions.getLeftToolbar().add(
+ new ToolbarSeparatorDescriptor(Type.spacer, SitebarActionsPresenter.LEFT_TOOLBAR));
+ siteActions.getLeftToolbar().add(
+ new ToolbarSeparatorDescriptor(Type.spacer, SitebarActionsPresenter.LEFT_TOOLBAR));
+ siteActions.getLeftToolbar().add(chatIcon);
}
+ }
- private void createDialogIfNeeded() {
- if (dialog == null) {
- dialog = new Dialog();
- dialog.setHeading(i18n.t(CHAT_TITLE));
- dialog.setClosable(true);
- dialog.setResizable(true);
- dialog.setButtons("");
- dialog.setBodyStyleName("k-chat-window");
- dialog.setScrollMode(Scroll.NONE);
- dialog.setHideOnButtonClick(true);
- dialog.setCollapsible(true);
- // final Widget btn = (Widget)
- // chatIcon.getValue(ParentWidget.PARENT_UI);
- dialog.setPosition(118, 1);
- dialog.setIcon(AbstractImagePrototype.create(chatResources.chat()));
- // dialog.getItem(0).getFocusSupport().setIgnore(true);
- initEmite();
- }
- }
+ private void createDialog(final KuneHablarWidget widget, final HtmlConfig htmlConfig) {
+ widget.addStyleName("k-chat-panel");
+ setSize(widget, htmlConfig);
+ dialog.add(widget);
+ }
- private boolean dialogVisible() {
- return dialog != null && dialog.isVisible();
+ private void createDialogIfNeeded() {
+ if (dialog == null) {
+ dialog = new Dialog();
+ dialog.setHeading(i18n.t(CHAT_TITLE));
+ dialog.setClosable(true);
+ dialog.setResizable(true);
+ dialog.setButtons("");
+ dialog.setBodyStyleName("k-chat-window");
+ dialog.setScrollMode(Scroll.NONE);
+ dialog.setHideOnButtonClick(true);
+ dialog.setCollapsible(true);
+ // final Widget btn = (Widget)
+ // chatIcon.getValue(ParentWidget.PARENT_UI);
+ dialog.setPosition(118, 1);
+ dialog.setIcon(AbstractImagePrototype.create(chatResources.chat()));
+ // dialog.getItem(0).getFocusSupport().setIgnore(true);
+ initEmite();
}
+ }
- @Override
- public void doLogin() {
- assert session.getCurrentUserInfo() != null;
- doLogin(session.getCurrentUserInfo());
- }
+ private boolean dialogVisible() {
+ return dialog != null && dialog.isVisible();
+ }
- private void doLogin(final UserInfoDTO user) {
- createActionIfNeeded();
- createDialogIfNeeded();
- chatOptions.username = user.getChatName();
- chatOptions.passwd = user.getChatPassword();
- chatOptions.resource = "emite-" + new Date().getTime() + "-kune";
- chatOptions.useruri = XmppURI.uri(chatOptions.username, chatOptions.domain, chatOptions.resource);
- createActionIfNeeded();
- createDialogIfNeeded();
- chatIcon.setVisible(true);
- login(chatOptions.useruri, chatOptions.passwd);
- }
+ @Override
+ public void doLogin() {
+ assert session.getCurrentUserInfo() != null;
+ doLogin(session.getCurrentUserInfo());
+ }
- private void initEmite() {
- loadIcons(chatResources);
+ private void doLogin(final UserInfoDTO user) {
+ createActionIfNeeded();
+ createDialogIfNeeded();
+ chatOptions.username = user.getChatName();
+ chatOptions.passwd = user.getChatPassword();
+ chatOptions.resource = "emite-" + new Date().getTime() + "-kune";
+ chatOptions.useruri = XmppURI.uri(chatOptions.username, chatOptions.domain, chatOptions.resource);
+ createActionIfNeeded();
+ createDialogIfNeeded();
+ chatIcon.setVisible(true);
+ login(chatOptions.useruri, chatOptions.passwd);
+ }
- final HablarConfig config = HablarConfig.getFromMeta();
- final HtmlConfig htmlConfig = HtmlConfig.getFromMeta();
- config.dockConfig.headerSize = 0;
- config.dockConfig.rosterWidth = 150;
- config.dockConfig.rosterDock = "left";
- final KuneHablarWidget widget = new KuneHablarWidget(config.layout, config.tabHeaderSize);
- final Hablar hablar = widget.getHablar();
- HablarComplete.install(hablar, config);
- new KuneHablarSignals(eventBus, xmppSession, hablar, action);
- if (htmlConfig.hasLogger) {
- new HablarConsole(hablar);
- }
+ private void initEmite() {
+ loadIcons(chatResources);
- if (htmlConfig.hasLogin) {
- new HablarLogin(hablar, LoginConfig.getFromMeta());
- }
- new KuneSoundManager(eventBus, config.soundConfig);
- createDialog(widget, htmlConfig);
+ final HablarConfig config = HablarConfig.getFromMeta();
+ final HtmlConfig htmlConfig = HtmlConfig.getFromMeta();
+ config.dockConfig.headerSize = 0;
+ config.dockConfig.rosterWidth = 150;
+ config.dockConfig.rosterDock = "left";
+ final KuneHablarWidget widget = new KuneHablarWidget(config.layout, config.tabHeaderSize);
+ final Hablar hablar = widget.getHablar();
+ HablarComplete.install(hablar, config);
+ new KuneHablarSignals(eventBus, xmppSession, hablar, action);
+ if (htmlConfig.hasLogger) {
+ new HablarConsole(hablar);
}
- @Override
- public boolean isBuddie(final String shortName) {
- return isBuddie(uriFrom(shortName));
+ if (htmlConfig.hasLogin) {
+ new HablarLogin(hablar, LoginConfig.getFromMeta());
}
+ new KuneSoundManager(eventBus, config.soundConfig);
+ createDialog(widget, htmlConfig);
+ }
- @Override
- public boolean isBuddie(final XmppURI jid) {
- if (roster.isRosterReady()) {
- if (roster.getItemByJID(jid) != null) {
- return true;
- }
- }
- return false;
- }
+ @Override
+ public boolean isBuddie(final String shortName) {
+ return isBuddie(uriFrom(shortName));
+ }
- @Override
- public boolean isLoggedIn() {
- return xmppSession.isReady();
+ @Override
+ public boolean isBuddie(final XmppURI jid) {
+ if (roster.isRosterReady()) {
+ if (roster.getItemByJID(jid) != null) {
+ return true;
+ }
}
+ return false;
+ }
- @Override
- public Room joinRoom(final String roomName, final String userAlias) {
- return joinRoom(roomName, null, userAlias);
- }
+ @Override
+ public boolean isLoggedIn() {
+ return xmppSession.isReady();
+ }
- @Override
- public Room joinRoom(final String roomName, final String subject, final String userAlias) {
- Room room = null;
- if (xmppSession.isReady()) {
- final XmppURI roomURI = XmppURI.uri(roomName + "@" + chatOptions.roomHost + "/" + chatOptions.username);
- room = roomManager.open(roomURI, roomManager.getDefaultHistoryOptions());
- if (TextUtils.notEmpty(subject)) {
- RoomSubject.requestSubjectChange(room, subject);
- }
- } else {
- NotifyUser.error(i18n.t("Error"), i18n.t("To join a chatroom you need to be 'online'"), true);
- }
- return room;
- }
+ @Override
+ public Room joinRoom(final String roomName, final String userAlias) {
+ return joinRoom(roomName, null, userAlias);
+ }
- public void loadIcons(final ChatResources others) {
- final AltIconsBundle bundle = GWT.create(AltIconsBundle.class);
- Icons.register(Icons.BUDDY_ADD, bundle.buddyAddIcon());
- Icons.register(Icons.BUDDY, bundle.buddyIcon());
- Icons.register(Icons.BUDDY_DND, others.busy());
- Icons.register(Icons.BUDDY_OFF, others.offline());
- Icons.register(Icons.BUDDY_ON, others.online());
- Icons.register(Icons.BUDDY_WAIT, others.away());
- Icons.register(Icons.ADD_CHAT, bundle.chatAddIcon());
- Icons.register(Icons.CHAT, others.xa());
- Icons.register(Icons.CLIPBOARD, bundle.clipboardIcon());
- Icons.register(Icons.CLOSE, bundle.closeIcon());
- Icons.register(Icons.CONSOLE, bundle.consoleIcon());
- Icons.register(Icons.ADD_GROUP, bundle.groupAddIcon());
- Icons.register(Icons.GROUP_CHAT, bundle.groupChatIcon());
- Icons.register(Icons.GROUP_CHAT_ADD, bundle.groupChatAddIcon());
- Icons.register(Icons.LOADING, bundle.loadingIcon());
- Icons.register(Icons.MENU, bundle.menuIcon());
- Icons.register(Icons.MISSING_ICON, bundle.missingIcon());
- Icons.register(Icons.NOT_CONNECTED, others.offline());
- Icons.register(Icons.CONNECTED, others.online());
- Icons.register(Icons.ROSTER, bundle.rosterIcon());
- Icons.register(Icons.SEARCH, bundle.searchIcon());
+ @Override
+ public Room joinRoom(final String roomName, final String subject, final String userAlias) {
+ Room room = null;
+ if (xmppSession.isReady()) {
+ final XmppURI roomURI = XmppURI.uri(roomName + "@" + chatOptions.roomHost + "/"
+ + chatOptions.username);
+ room = roomManager.open(roomURI, roomManager.getDefaultHistoryOptions());
+ if (TextUtils.notEmpty(subject)) {
+ RoomSubject.requestSubjectChange(room, subject);
+ }
+ } else {
+ NotifyUser.error(i18n.t("Error"), i18n.t("To join a chatroom you need to be 'online'"), true);
}
+ return room;
+ }
- @Override
- public void login(final XmppURI uri, final String passwd) {
- xmppSession.login(uri, passwd);
- }
+ public void loadIcons(final ChatResources others) {
+ final AltIconsBundle bundle = GWT.create(AltIconsBundle.class);
+ Icons.register(Icons.BUDDY_ADD, bundle.buddyAddIcon());
+ Icons.register(Icons.BUDDY, bundle.buddyIcon());
+ Icons.register(Icons.BUDDY_DND, others.busy());
+ Icons.register(Icons.BUDDY_OFF, others.offline());
+ Icons.register(Icons.BUDDY_ON, others.online());
+ Icons.register(Icons.BUDDY_WAIT, others.away());
+ Icons.register(Icons.ADD_CHAT, bundle.chatAddIcon());
+ Icons.register(Icons.CHAT, others.xa());
+ Icons.register(Icons.CLIPBOARD, bundle.clipboardIcon());
+ Icons.register(Icons.CLOSE, bundle.closeIcon());
+ Icons.register(Icons.CONSOLE, bundle.consoleIcon());
+ Icons.register(Icons.ADD_GROUP, bundle.groupAddIcon());
+ Icons.register(Icons.GROUP_CHAT, bundle.groupChatIcon());
+ Icons.register(Icons.GROUP_CHAT_ADD, bundle.groupChatAddIcon());
+ Icons.register(Icons.LOADING, bundle.loadingIcon());
+ Icons.register(Icons.MENU, bundle.menuIcon());
+ Icons.register(Icons.MISSING_ICON, bundle.missingIcon());
+ Icons.register(Icons.NOT_CONNECTED, others.offline());
+ Icons.register(Icons.CONNECTED, others.online());
+ Icons.register(Icons.ROSTER, bundle.rosterIcon());
+ Icons.register(Icons.SEARCH, bundle.searchIcon());
+ }
- @Override
- public boolean loginIfNecessary() {
- if (!isLoggedIn()) {
- doLogin();
- return true;
- }
- return false;
- }
+ @Override
+ public void login(final XmppURI uri, final String passwd) {
+ xmppSession.login(uri, passwd);
+ }
- @Override
- public void logout() {
- if (dialogVisible()) {
- dialog.hide();
- }
- if (isLoggedIn()) {
- xmppSession.logout();
- }
+ @Override
+ public boolean loginIfNecessary() {
+ if (!isLoggedIn()) {
+ doLogin();
+ return true;
}
+ return false;
+ }
- @Override
- public XmppURI roomUriFrom(final String shortName) {
- return XmppURI.jid(shortName + "@" + chatOptions.roomHost);
+ @Override
+ public void logout() {
+ if (dialogVisible()) {
+ dialog.hide();
}
-
- @Override
- public void setAvatar(final String photoBinary) {
- Suco.get(AvatarManager.class).setVCardAvatar(photoBinary);
+ if (isLoggedIn()) {
+ xmppSession.logout();
}
+ }
- private void setSize(final Widget widget, final HtmlConfig htmlConfig) {
+ @Override
+ public XmppURI roomUriFrom(final String shortName) {
+ return XmppURI.jid(shortName + "@" + chatOptions.roomHost);
+ }
- if (htmlConfig.width != null) {
- widget.setWidth("98%");
- dialog.setWidth(htmlConfig.width);
- }
- if (htmlConfig.height != null) {
- widget.setHeight("98%");
- dialog.setHeight(htmlConfig.height);
- }
- }
+ @Override
+ public void setAvatar(final String photoBinary) {
+ Suco.get(AvatarManager.class).setVCardAvatar(photoBinary);
+ }
- @Override
- public void show() {
- showDialog(true);
- }
+ private void setSize(final Widget widget, final HtmlConfig htmlConfig) {
- private void showDialog(final boolean show) {
- Log.info("Show dialog: " + show);
- if (session.isLogged()) {
- createDialogIfNeeded();
- if (show) {
- dialog.show();
- dialog.setZIndex(0);
- dialog.getHeader().setZIndex(0);
- } else {
- dialog.hide();
- }
- }
+ if (htmlConfig.width != null) {
+ widget.setWidth("98%");
+ dialog.setWidth(htmlConfig.width);
}
+ if (htmlConfig.height != null) {
+ widget.setHeight("98%");
+ dialog.setHeight(htmlConfig.height);
+ }
+ }
- private void toggleShowDialog() {
- Log.info("Toggle!");
- showDialog(dialog == null ? true : !dialogVisible());
+ @Override
+ public void show() {
+ showDialog(true);
+ }
+
+ private void showDialog(final boolean show) {
+ Log.info("Show dialog: " + show);
+ if (session.isLogged()) {
+ createDialogIfNeeded();
+ if (show) {
+ dialog.show();
+ dialog.setZIndex(0);
+ dialog.getHeader().setZIndex(0);
+ } else {
+ dialog.hide();
+ }
}
+ }
- @Override
- public XmppURI uriFrom(final String shortName) {
- return XmppURI.jid(shortName + "@" + chatOptions.domain);
- }
+ private void toggleShowDialog() {
+ Log.info("Toggle!");
+ showDialog(dialog == null ? true : !dialogVisible());
+ }
+
+ @Override
+ public XmppURI uriFrom(final String shortName) {
+ return XmppURI.jid(shortName + "@" + chatOptions.domain);
+ }
}
Deleted: trunk/src/main/java/cc/kune/client/ExtendedGinModule.java
===================================================================
--- trunk/src/main/java/cc/kune/client/ExtendedGinModule.java 2011-05-05 21:20:17 UTC (rev 1348)
+++ trunk/src/main/java/cc/kune/client/ExtendedGinModule.java 2011-05-05 23:52:34 UTC (rev 1349)
@@ -1,20 +0,0 @@
-package cc.kune.client;
-
-import com.google.inject.Singleton;
-import com.gwtplatform.mvp.client.gin.AbstractPresenterModule;
-
-public abstract class ExtendedGinModule extends AbstractPresenterModule {
-
- protected void eagle(final Class<?> type) {
- bind(type).asEagerSingleton();
- }
-
- protected void s(final Class<?> type) {
- bind(type).in(Singleton.class);
- }
-
- protected <V, W> void s(final Class<V> type, final Class<? extends V> typeImpl) {
- bind(type).to(typeImpl).in(Singleton.class);
- }
-
-}
Copied: trunk/src/main/java/cc/kune/common/client/ExtendedGinModule.java (from rev 1339, trunk/src/main/java/cc/kune/client/ExtendedGinModule.java)
===================================================================
--- trunk/src/main/java/cc/kune/common/client/ExtendedGinModule.java (rev 0)
+++ trunk/src/main/java/cc/kune/common/client/ExtendedGinModule.java 2011-05-05 23:52:34 UTC (rev 1349)
@@ -0,0 +1,20 @@
+package cc.kune.common.client;
+
+import com.google.inject.Singleton;
+import com.gwtplatform.mvp.client.gin.AbstractPresenterModule;
+
+public abstract class ExtendedGinModule extends AbstractPresenterModule {
+
+ protected void eagle(final Class<?> type) {
+ bind(type).asEagerSingleton();
+ }
+
+ protected void s(final Class<?> type) {
+ bind(type).in(Singleton.class);
+ }
+
+ protected <V, W> void s(final Class<V> type, final Class<? extends V> typeImpl) {
+ bind(type).to(typeImpl).in(Singleton.class);
+ }
+
+}
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-05-05 21:20:17 UTC (rev 1348)
+++ trunk/src/main/java/cc/kune/common/client/actions/gwtui/AbstractGwtButtonGui.java 2011-05-05 23:52:34 UTC (rev 1349)
@@ -48,6 +48,10 @@
this(null, false);
}
+ public AbstractGwtButtonGui(final boolean enableTongle) {
+ this(null, enableTongle);
+ }
+
public AbstractGwtButtonGui(final ButtonDescriptor buttonDescriptor) {
this(buttonDescriptor, false);
}
Modified: trunk/src/main/java/cc/kune/common/client/actions/gwtui/GwtPushButtonGui.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/actions/gwtui/GwtPushButtonGui.java 2011-05-05 21:20:17 UTC (rev 1348)
+++ trunk/src/main/java/cc/kune/common/client/actions/gwtui/GwtPushButtonGui.java 2011-05-05 23:52:34 UTC (rev 1349)
@@ -25,22 +25,28 @@
import cc.kune.common.client.actions.ui.descrip.GuiActionDescrip;
import cc.kune.common.client.actions.ui.descrip.PushButtonDescriptor;
-public class GwtPushButtonGui extends GwtButtonGui {
- @Override
- public AbstractGuiItem create(final GuiActionDescrip descriptor) {
- super.descriptor = descriptor;
- super.enableTongle = true;
- final PushButtonDescriptor btn = (PushButtonDescriptor) descriptor;
- setPressed(btn.isPushed());
- btn.addPropertyChangeListener(new PropertyChangeListener() {
- @Override
- public void propertyChange(final PropertyChangeEvent event) {
- if (event.getPropertyName().equals(PushButtonDescriptor.PUSHED)) {
- setPressed(btn.isPushed());
- }
- }
- });
- return this;
- }
+public class GwtPushButtonGui extends AbstractGwtButtonGui {
+ public GwtPushButtonGui() {
+ super(true);
+ }
+
+ @Override
+ public AbstractGuiItem create(final GuiActionDescrip descriptor) {
+ super.create(descriptor);
+ super.descriptor = descriptor;
+ super.enableTongle = true;
+ final PushButtonDescriptor btn = (PushButtonDescriptor) descriptor;
+ setPressed(btn.isPushed());
+ btn.addPropertyChangeListener(new PropertyChangeListener() {
+ @Override
+ public void propertyChange(final PropertyChangeEvent event) {
+ if (event.getPropertyName().equals(PushButtonDescriptor.PUSHED)) {
+ setPressed(btn.isPushed());
+ }
+ }
+ });
+ return this;
+ }
+
}
Modified: trunk/src/main/java/cc/kune/core/client/CoreGinModule.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/CoreGinModule.java 2011-05-05 21:20:17 UTC (rev 1348)
+++ trunk/src/main/java/cc/kune/core/client/CoreGinModule.java 2011-05-05 23:52:34 UTC (rev 1349)
@@ -19,7 +19,7 @@
*/
package cc.kune.core.client;
-import cc.kune.client.ExtendedGinModule;
+import cc.kune.common.client.ExtendedGinModule;
import cc.kune.common.client.actions.gwtui.GwtGuiProvider;
import cc.kune.common.client.actions.gxtui.GxtGuiProvider;
import cc.kune.common.client.actions.ui.bind.DefaultGuiProvider;
Added: trunk/src/main/java/cc/kune/core/client/events/AvatarChangedEvent.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/events/AvatarChangedEvent.java (rev 0)
+++ trunk/src/main/java/cc/kune/core/client/events/AvatarChangedEvent.java 2011-05-05 23:52:34 UTC (rev 1349)
@@ -0,0 +1,85 @@
+package cc.kune.core.client.events;
+
+import com.google.gwt.event.shared.EventHandler;
+import com.google.gwt.event.shared.GwtEvent;
+import com.google.gwt.event.shared.HandlerRegistration;
+import com.google.gwt.event.shared.HasHandlers;
+
+public class AvatarChangedEvent extends GwtEvent<AvatarChangedEvent.AvatarChangedHandler> {
+
+ public interface AvatarChangedHandler extends EventHandler {
+ public void onAvatarChanged(AvatarChangedEvent event);
+ }
+
+ public interface HasAvatarChangedHandlers extends HasHandlers {
+ HandlerRegistration addAvatarChangedHandler(AvatarChangedHandler handler);
+ }
+
+ private static final Type<AvatarChangedHandler> TYPE = new Type<AvatarChangedHandler>();
+
+ public static void fire(final HasHandlers source, final java.lang.String photoBinary) {
+ source.fireEvent(new AvatarChangedEvent(photoBinary));
+ }
+
+ public static Type<AvatarChangedHandler> getType() {
+ return TYPE;
+ }
+
+ java.lang.String photoBinary;
+
+ protected AvatarChangedEvent() {
+ // Possibly for serialization.
+ }
+
+ public AvatarChangedEvent(final java.lang.String photoBinary) {
+ this.photoBinary = photoBinary;
+ }
+
+ @Override
+ protected void dispatch(final AvatarChangedHandler handler) {
+ handler.onAvatarChanged(this);
+ }
+
+ @Override
+ public boolean equals(final Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ final AvatarChangedEvent other = (AvatarChangedEvent) obj;
+ if (photoBinary == null) {
+ if (other.photoBinary != null) {
+ return false;
+ }
+ } else if (!photoBinary.equals(other.photoBinary)) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public Type<AvatarChangedHandler> getAssociatedType() {
+ return TYPE;
+ }
+
+ public java.lang.String getPhotoBinary() {
+ return photoBinary;
+ }
+
+ @Override
+ public int hashCode() {
+ int hashCode = 23;
+ hashCode = (hashCode * 37) + (photoBinary == null ? 1 : photoBinary.hashCode());
+ return hashCode;
+ }
+
+ @Override
+ public String toString() {
+ return "AvatarChangedEvent[" + photoBinary + "]";
+ }
+}
Property changes on: trunk/src/main/java/cc/kune/core/client/events/AvatarChangedEvent.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/src/main/java/cc/kune/core/client/events/RenameContentEvent.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/events/RenameContentEvent.java (rev 0)
+++ trunk/src/main/java/cc/kune/core/client/events/RenameContentEvent.java 2011-05-05 23:52:34 UTC (rev 1349)
@@ -0,0 +1,116 @@
+package cc.kune.core.client.events;
+
+import com.google.gwt.event.shared.EventHandler;
+import com.google.gwt.event.shared.GwtEvent;
+import com.google.gwt.event.shared.HandlerRegistration;
+import com.google.gwt.event.shared.HasHandlers;
+
+public class RenameContentEvent extends GwtEvent<RenameContentEvent.RenameContentHandler> {
+
+ public interface HasRenameEventHandlers extends HasHandlers {
+ HandlerRegistration addRenameEventHandler(RenameContentHandler handler);
+ }
+
+ public interface RenameContentHandler extends EventHandler {
+ public void onRenameEvent(RenameContentEvent event);
+ }
+
+ private static final Type<RenameContentHandler> TYPE = new Type<RenameContentHandler>();
+
+ public static void fire(final HasHandlers source,
+ final cc.kune.core.shared.domain.utils.StateToken token, final java.lang.String oldName,
+ final java.lang.String newName) {
+ source.fireEvent(new RenameContentEvent(token, oldName, newName));
+ }
+
+ public static Type<RenameContentHandler> getType() {
+ return TYPE;
+ }
+
+ java.lang.String newName;
+ java.lang.String oldName;
+ cc.kune.core.shared.domain.utils.StateToken token;
+
+ protected RenameContentEvent() {
+ // Possibly for serialization.
+ }
+
+ public RenameContentEvent(final cc.kune.core.shared.domain.utils.StateToken token,
+ final java.lang.String oldName, final java.lang.String newName) {
+ this.token = token;
+ this.oldName = oldName;
+ this.newName = newName;
+ }
+
+ @Override
+ protected void dispatch(final RenameContentHandler handler) {
+ handler.onRenameEvent(this);
+ }
+
+ @Override
+ public boolean equals(final Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ final RenameContentEvent other = (RenameContentEvent) obj;
+ if (token == null) {
+ if (other.token != null) {
+ return false;
+ }
+ } else if (!token.equals(other.token)) {
+ return false;
+ }
+ if (oldName == null) {
+ if (other.oldName != null) {
+ return false;
+ }
+ } else if (!oldName.equals(other.oldName)) {
+ return false;
+ }
+ if (newName == null) {
+ if (other.newName != null) {
+ return false;
+ }
+ } else if (!newName.equals(other.newName)) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public Type<RenameContentHandler> getAssociatedType() {
+ return TYPE;
+ }
+
+ public java.lang.String getNewName() {
+ return newName;
+ }
+
+ public java.lang.String getOldName() {
+ return oldName;
+ }
+
+ public cc.kune.core.shared.domain.utils.StateToken getToken() {
+ return token;
+ }
+
+ @Override
+ public int hashCode() {
+ int hashCode = 23;
+ hashCode = (hashCode * 37) + (token == null ? 1 : token.hashCode());
+ hashCode = (hashCode * 37) + (oldName == null ? 1 : oldName.hashCode());
+ hashCode = (hashCode * 37) + (newName == null ? 1 : newName.hashCode());
+ return hashCode;
+ }
+
+ @Override
+ public String toString() {
+ return "RenameEventEvent[" + token + "," + oldName + "," + newName + "]";
+ }
+}
Property changes on: trunk/src/main/java/cc/kune/core/client/events/RenameContentEvent.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/src/main/java/cc/kune/core/public/images/ie6/corner_dialog_topleft.png
===================================================================
(Binary files differ)
Property changes on: trunk/src/main/java/cc/kune/core/public/images/ie6/corner_dialog_topleft.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/src/main/java/cc/kune/core/public/images/ie6/corner_dialog_topright.png
===================================================================
(Binary files differ)
Property changes on: trunk/src/main/java/cc/kune/core/public/images/ie6/corner_dialog_topright.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/src/main/java/cc/kune/core/public/images/ie6/hborder_blue_shadow.png
===================================================================
(Binary files differ)
Property changes on: trunk/src/main/java/cc/kune/core/public/images/ie6/hborder_blue_shadow.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/src/main/java/cc/kune/core/public/images/ie6/hborder_gray_shadow.png
===================================================================
(Binary files differ)
Property changes on: trunk/src/main/java/cc/kune/core/public/images/ie6/hborder_gray_shadow.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/src/main/java/cc/kune/core/public/images/ie6/vborder_blue_shadow.png
===================================================================
(Binary files differ)
Property changes on: trunk/src/main/java/cc/kune/core/public/images/ie6/vborder_blue_shadow.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/src/main/java/cc/kune/core/public/images/ie6/vborder_gray_shadow.png
===================================================================
(Binary files differ)
Property changes on: trunk/src/main/java/cc/kune/core/public/images/ie6/vborder_gray_shadow.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: trunk/src/main/java/cc/kune/core/public/ws.css
===================================================================
--- trunk/src/main/java/cc/kune/core/public/ws.css 2011-05-05 21:20:17 UTC (rev 1348)
+++ trunk/src/main/java/cc/kune/core/public/ws.css 2011-05-05 23:52:34 UTC (rev 1349)
@@ -172,6 +172,7 @@
cursor: hand;
}
+
.gwt-RichTextArea {
border: 1px solid black;
background-color: white;
@@ -335,11 +336,13 @@
font: inherit;
}
-k-btn-sitebar button spin,.k-sitebar button spin, .k-btn-sitebar div, .k-btn-sitebar span,.k-btn-sitebar button span,.k-sitebar button span {
+k-btn-sitebar button spin,.k-sitebar button spin,.k-btn-sitebar div,.k-btn-sitebar span,.k-btn-sitebar button span,.k-sitebar button span
+ {
text-decoration: underline;
}
-.k-btn-sitebar,.k-btn-sitebar button,.k-sitebar button, .k-btn-sitebar div,.k-btn-sitebar button div,.k-sitebar button div {
+.k-btn-sitebar,.k-btn-sitebar button,.k-sitebar button,.k-btn-sitebar div,.k-btn-sitebar button div,.k-sitebar button div
+ {
font: 13px 'Ubuntu', arial;
color: #B3B3B3;
cursor: pointer;
@@ -795,7 +798,6 @@
white-space: nowrap;
}
*/
-
.k-sn-mainpanel .x-btn button,.k-sn-mainpanel button,button.k-button {
font: 13px 'Ubuntu', arial;
border: 2px solid #CCCCCC;
@@ -809,19 +811,12 @@
-moz-border-radius: 5px;
border-radius: 5px;
vertical-align: middle;
-/* line-height: 2em !important; */
outline: 0 none;
- /* height: 26px !important; */
font-weight: bold;
width: auto !IMPORTANT;
width: 50px;
min-width: 50px;
height: 28px;
- /*
-font-size:small;
- cursor: pointer;
- border: 2px gray solid;
- padding-left: 25px !important; */
}
.k-sn-mainpanel .x-btn button:hover,.k-sn-mainpanel button:hover,button.k-button:hover
@@ -843,6 +838,67 @@
background: #ffffff;
}
+.k-button-center {
+ border-left: 1px solid #CCCCCC !important;
+ border-right: 1px solid #CCCCCC !important;
+ -webkit-border-radius: 0px !important;
+ -moz-border-radius: 0px !important;
+ border-radius: 0px !important;
+ margin-left: 0px !important;
+ margin-right: 0px !important;
+}
+
+.k-button-right {
+ border-left: 1px solid #CCCCCC !important;
+ -webkit-border-top-left-radius: 0px !important;
+ -moz-border-radius-topleft: 0px !important;
+ border-top-left-radius: 0px !important;
+ -webkit-border-bottom-left-radius: 0px !important;
+ -moz-border-radius-bottomleft: 0px !important;
+ border-bottom-left-radius: 0px !important;
+ margin-left: 0px !important;
+}
+
+.k-button-left {
+ border-right: 1px solid #CCCCCC !important;
+ -webkit-border-top-right-radius: 0px !important;
+ -moz-border-radius-topright: 0px !important;
+ border-top-right-radius: 0px !important;
+ -webkit-border-bottom-right-radius: 0px !important;
+ -moz-border-radius-bottomright: 0px !important;
+ border-bottom-right-radius: 0px !important;
+ margin-right: 0px !important;
+}
+
+button.k-button-center:hover {
+ border-left: 1px solid orange !important;
+ border-right: 1px solid orange !important;
+ outline: 0 none;
+}
+
+button.k-button-right:hover {
+ border-left: 1px solid orange !important;
+ outline: 0 none;
+}
+
+button.k-button-left:hover {
+ border-right: 1px solid orange !important;
+ outline: 0 none;
+}
+
+button[disabled]:active, button[disabled],
+input[type="reset"][disabled]:active,
+input[type="reset"][disabled],
+input[type="button"][disabled]:active,
+input[type="button"][disabled],
+select[disabled] > input[type="button"],
+select[disabled] > input[type="button"]:active,
+input[type="submit"][disabled]:active,
+input[type="submit"][disabled], .k-button-disabled {
+ color: gray !important;
+}
+
+/* end buttons */
.k-sn-collabslabel {
}
@@ -1108,7 +1164,7 @@
-webkit-border-bottom-left-radius: 5px;
-moz-border-radius-bottomleft: 5px;
border-bottom-left-radius: 5px;
- kfilter: alpha(opacity = 90);
+ kfilter: alpha(opacity = 90);
-moz-opacity: 0.90;
-khtml-opacity: 0.90;
opacity: 0.90;
@@ -1146,7 +1202,6 @@
}
/* end of suggestbox */
-
.k-table {
display: table;
}
@@ -1160,57 +1215,69 @@
}
/* Decorated tabbar */
+.gwt-DecoratedTabBar {
-.gwt-DecoratedTabBar {
}
+
.gwt-DecoratedTabBar .gwt-TabBarFirst {
- width: 5px; /* first tab distance from the left */
+ width: 5px; /* first tab distance from the left */
}
+
.gwt-DecoratedTabBar .gwt-TabBarRest {
+
}
+
.gwt-DecoratedTabBar .gwt-TabBarItem {
border-collapse: collapse;
margin-left: 6px;
}
+
.gwt-DecoratedTabBar .tabTopCenter {
padding: 0px;
background: #e3e3e3;
}
-.gwt-DecoratedTabBar .tabTopLeft,
-.gwt-DecoratedTabBar .tabTopRight {
+
+.gwt-DecoratedTabBar .tabTopLeft,.gwt-DecoratedTabBar .tabTopRight {
padding: 0px;
zoom: 1;
}
-.gwt-DecoratedTabBar .tabTopLeftInner,
-.gwt-DecoratedTabBar .tabTopRightInner {
+
+.gwt-DecoratedTabBar .tabTopLeftInner,.gwt-DecoratedTabBar .tabTopRightInner
+ {
width: 6px;
height: 6px;
}
+
.gwt-DecoratedTabBar .tabTopLeft {
background: url(images/corner.png) no-repeat 0px -55px;
-background: url(images/corner_ie6.png) no-repeat 0px -55px;
}
+
.gwt-DecoratedTabBar .tabTopRight {
background: url(images/corner.png) no-repeat -6px -55px;
-background: url(images/corner_ie6.png) no-repeat -6px -55px;
}
-* html .gwt-DecoratedTabBar .tabTopLeftInner,
-* html .gwt-DecoratedTabBar .tabTopRightInner {
+
+* html .gwt-DecoratedTabBar .tabTopLeftInner,* html .gwt-DecoratedTabBar .tabTopRightInner
+ {
width: 6px;
height: 6px;
overflow: hidden;
}
-.gwt-DecoratedTabBar .tabMiddleLeft,
-.gwt-DecoratedTabBar .tabMiddleRight {
+
+.gwt-DecoratedTabBar .tabMiddleLeft,.gwt-DecoratedTabBar .tabMiddleRight
+ {
width: 6px;
padding: 0px;
background: #e3e3e3 url(images/hborder.png) repeat-x 0px -1463px;
}
-.gwt-DecoratedTabBar .tabMiddleLeftInner,
-.gwt-DecoratedTabBar .tabMiddleRightInner {
+
+.gwt-DecoratedTabBar .tabMiddleLeftInner,.gwt-DecoratedTabBar .tabMiddleRightInner
+ {
width: 1px;
height: 1px;
}
+
.gwt-DecoratedTabBar .tabMiddleCenter {
padding: 0px 4px 2px 4px;
cursor: pointer;
@@ -1220,27 +1287,33 @@
text-align: center;
background: #e3e3e3 url(images/hborder.png) repeat-x 0px -1463px;
}
+
.gwt-DecoratedTabBar .gwt-TabBarItem-selected .tabTopCenter {
background: #747474;
}
+
.gwt-DecoratedTabBar .gwt-TabBarItem-selected .tabTopLeft {
background-position: 0px -61px;
}
+
.gwt-DecoratedTabBar .gwt-TabBarItem-selected .tabTopRight {
background-position: -6px -61px;
}
-.gwt-DecoratedTabBar .gwt-TabBarItem-selected .tabMiddleLeft,
-.gwt-DecoratedTabBar .gwt-TabBarItem-selected .tabMiddleRight {
+
+.gwt-DecoratedTabBar .gwt-TabBarItem-selected .tabMiddleLeft,.gwt-DecoratedTabBar .gwt-TabBarItem-selected .tabMiddleRight
+ {
background: #bcbcbc url(images/hborder.png) repeat-x 0px -2511px;
}
+
.gwt-DecoratedTabBar .gwt-TabBarItem-selected .tabMiddleCenter {
cursor: default;
background: #bcbcbc url(images/hborder.png) repeat-x 0px -2511px;
color: white;
}
+
.gwt-DecoratedTabBar .gwt-TabBarItem-disabled .tabMiddleCenter {
cursor: default;
color: #999999;
}
-/* end Decorated tabbar */
+/* end Decorated tabbar */
\ No newline at end of file
Modified: trunk/src/main/java/cc/kune/docs/client/DocsClientTool.java
===================================================================
--- trunk/src/main/java/cc/kune/docs/client/DocsClientTool.java 2011-05-05 21:20:17 UTC (rev 1348)
+++ trunk/src/main/java/cc/kune/docs/client/DocsClientTool.java 2011-05-05 23:52:34 UTC (rev 1349)
@@ -34,36 +34,37 @@
public class DocsClientTool extends FoldableAbstractClientTool {
- private final NavResources navResources;
+ private final NavResources navResources;
- @Inject
- public DocsClientTool(final I18nUITranslationService i18n, final ToolSelector toolSelector,
- final ContentCapabilitiesRegistry cntCapRegistry, final NavResources navResources) {
- super(NAME, i18n.t("documents"), toolSelector, cntCapRegistry);
- this.navResources = navResources;
+ @Inject
+ public DocsClientTool(final I18nUITranslationService i18n, final ToolSelector toolSelector,
+ final ContentCapabilitiesRegistry cntCapRegistry, final NavResources navResources) {
+ super(NAME, i18n.t("documents"), toolSelector, cntCapRegistry);
+ this.navResources = navResources;
- // registerAclEditableTypes(TYPE_DOCUMENT, TYPE_UPLOADEDFILE);
- registerAuthorableTypes(TYPE_DOCUMENT, TYPE_UPLOADEDFILE);
- registerDragableTypes(TYPE_DOCUMENT, TYPE_FOLDER, TYPE_UPLOADEDFILE);
- registerDropableTypes(TYPE_ROOT, TYPE_FOLDER);
- registerPublishModerableTypes(TYPE_DOCUMENT, TYPE_UPLOADEDFILE);
- registerRateableTypes(TYPE_DOCUMENT, TYPE_UPLOADEDFILE);
- registerRenamableTypes(TYPE_DOCUMENT, TYPE_FOLDER, TYPE_UPLOADEDFILE);
- registerTageableTypes(TYPE_DOCUMENT, TYPE_UPLOADEDFILE);
- registerTranslatableTypes(TYPE_DOCUMENT, TYPE_FOLDER);
+ // registerAclEditableTypes(TYPE_DOCUMENT, TYPE_UPLOADEDFILE);
+ registerAuthorableTypes(TYPE_DOCUMENT, TYPE_UPLOADEDFILE);
+ registerDragableTypes(TYPE_DOCUMENT, TYPE_FOLDER, TYPE_UPLOADEDFILE);
+ registerDropableTypes(TYPE_ROOT, TYPE_FOLDER);
+ registerPublishModerableTypes(TYPE_DOCUMENT, TYPE_UPLOADEDFILE);
+ registerRateableTypes(TYPE_DOCUMENT, TYPE_UPLOADEDFILE);
+ registerRenamableTypes(TYPE_DOCUMENT, TYPE_FOLDER, TYPE_UPLOADEDFILE);
+ registerTageableTypes(TYPE_DOCUMENT, TYPE_UPLOADEDFILE);
+ registerTranslatableTypes(TYPE_DOCUMENT, TYPE_FOLDER);
- registerIcons();
- }
+ registerIcons();
+ }
- @Override
- public String getName() {
- return NAME;
- }
+ @Override
+ public String getName() {
+ return NAME;
+ }
- private void registerIcons() {
- registerContentTypeIcon(TYPE_FOLDER, navResources.folder());
- registerContentTypeIcon(TYPE_DOCUMENT, navResources.page());
- registerUploadTypesAndMimes(TYPE_UPLOADEDFILE);
- }
+ private void registerIcons() {
+ registerContentTypeIcon(TYPE_FOLDER, navResources.folder());
+ registerContentTypeIcon(TYPE_ROOT, navResources.folder());
+ registerContentTypeIcon(TYPE_DOCUMENT, navResources.page());
+ registerUploadTypesAndMimes(TYPE_UPLOADEDFILE);
+ }
}
Modified: trunk/src/main/java/cc/kune/docs/client/DocsParts.java
===================================================================
--- trunk/src/main/java/cc/kune/docs/client/DocsParts.java 2011-05-05 21:20:17 UTC (rev 1348)
+++ trunk/src/main/java/cc/kune/docs/client/DocsParts.java 2011-05-05 23:52:34 UTC (rev 1349)
@@ -1,14 +1,23 @@
package cc.kune.docs.client;
import cc.kune.core.client.state.Session;
+import cc.kune.docs.client.actions.DocsClientActions;
+import cc.kune.docs.shared.DocsConstants;
+import cc.kune.gspace.client.tool.ContentViewerSelector;
+import cc.kune.gspace.client.viewers.ContentViewerPresenter;
+import cc.kune.gspace.client.viewers.FolderViewerPresenter;
import com.google.inject.Inject;
import com.google.inject.Provider;
public class DocsParts {
- @Inject
- public DocsParts(final Session session, final Provider<DocsClientTool> clientTool) {
- clientTool.get();
- }
+ @Inject
+ public DocsParts(final Session session, final Provider<DocsClientTool> clientTool,
+ final ContentViewerSelector viewerSelector, final DocsClientActions docsActions,
+ final ContentViewerPresenter contentViewer, final FolderViewerPresenter folderViewer) {
+ clientTool.get();
+ viewerSelector.register(contentViewer, true, DocsConstants.TYPE_DOCUMENT);
+ viewerSelector.register(folderViewer, true, DocsConstants.TYPE_ROOT, DocsConstants.TYPE_FOLDER);
+ }
}
\ No newline at end of file
Modified: trunk/src/main/java/cc/kune/docs/client/actions/DocsClientActions.java
===================================================================
--- trunk/src/main/java/cc/kune/docs/client/actions/DocsClientActions.java 2011-05-05 21:20:17 UTC (rev 1348)
+++ trunk/src/main/java/cc/kune/docs/client/actions/DocsClientActions.java 2011-05-05 23:52:34 UTC (rev 1349)
@@ -23,7 +23,6 @@
import static cc.kune.docs.shared.DocsConstants.TYPE_FOLDER;
import static cc.kune.docs.shared.DocsConstants.TYPE_ROOT;
import static cc.kune.docs.shared.DocsConstants.TYPE_UPLOADEDFILE;
-import cc.kune.blogs.client.actions.ContentViewerOptionsMenu;
import cc.kune.core.client.actions.ActionRegistryByType;
import cc.kune.core.client.i18n.I18nUITranslationService;
import cc.kune.core.client.resources.CoreResources;
@@ -31,6 +30,7 @@
import cc.kune.core.client.state.StateManager;
import cc.kune.gspace.client.actions.AbstractFoldableToolActions;
import cc.kune.gspace.client.actions.ActionGroups;
+import cc.kune.gspace.client.actions.ContentViewerOptionsMenu;
import cc.kune.gspace.client.actions.ParticipateInContentBtn;
import cc.kune.gspace.client.actions.RefreshContentMenuItem;
import cc.kune.gspace.client.actions.SetAsHomePageMenuItem;
Modified: trunk/src/main/java/cc/kune/domain/Container.java
===================================================================
--- trunk/src/main/java/cc/kune/domain/Container.java 2011-05-05 21:20:17 UTC (rev 1348)
+++ trunk/src/main/java/cc/kune/domain/Container.java 2011-05-05 23:52:34 UTC (rev 1349)
@@ -43,6 +43,8 @@
import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;
+import org.hibernate.annotations.LazyCollection;
+import org.hibernate.annotations.LazyCollectionOption;
import org.hibernate.search.annotations.ContainedIn;
import org.hibernate.search.annotations.DocumentId;
import org.hibernate.search.annotations.Field;
@@ -60,12 +62,14 @@
@Table(name = "containers")
public class Container implements HasId, HasStateToken {
- @ManyToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
+ @LazyCollection(LazyCollectionOption.FALSE)
+ @ManyToMany(cascade = CascadeType.ALL)
private List<Container> absolutePath;
@OneToOne(cascade = CascadeType.ALL)
private AccessLists accessLists;
+ @LazyCollection(LazyCollectionOption.FALSE)
@Fetch(FetchMode.JOIN)
@OrderBy("createdOn DESC")
@OneToMany(mappedBy = "parent", cascade = CascadeType.ALL, fetch = FetchType.EAGER)
@@ -74,6 +78,7 @@
@OneToMany(cascade = CascadeType.ALL)
private List<ContainerTranslation> containerTranslations;
+ @LazyCollection(LazyCollectionOption.FALSE)
@Fetch(FetchMode.JOIN)
@ContainedIn
@OrderBy("createdOn DESC")
Modified: trunk/src/main/java/cc/kune/gspace/client/GSpaceGinModule.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/GSpaceGinModule.java 2011-05-05 21:20:17 UTC (rev 1348)
+++ trunk/src/main/java/cc/kune/gspace/client/GSpaceGinModule.java 2011-05-05 23:52:34 UTC (rev 1349)
@@ -19,10 +19,10 @@
*/
package cc.kune.gspace.client;
-import cc.kune.blogs.client.actions.ContentViewerOptionsMenu;
-import cc.kune.client.ExtendedGinModule;
+import cc.kune.common.client.ExtendedGinModule;
import cc.kune.core.client.sitebar.search.SitebarSearchPanel;
import cc.kune.core.client.sitebar.search.SitebarSearchPresenter;
+import cc.kune.gspace.client.actions.ContentViewerOptionsMenu;
import cc.kune.gspace.client.actions.RenameAction;
import cc.kune.gspace.client.options.GroupOptions;
import cc.kune.gspace.client.options.GroupOptionsCollection;
@@ -75,8 +75,8 @@
import cc.kune.gspace.client.tool.selector.ToolSelectorPresenter;
import cc.kune.gspace.client.ui.footer.license.EntityLicensePanel;
import cc.kune.gspace.client.ui.footer.license.EntityLicensePresenter;
-import cc.kune.gspace.client.viewers.DocViewerPanel;
-import cc.kune.gspace.client.viewers.DocViewerPresenter;
+import cc.kune.gspace.client.viewers.ContentViewerPanel;
+import cc.kune.gspace.client.viewers.ContentViewerPresenter;
import cc.kune.gspace.client.viewers.FolderViewerAsTablePanel;
import cc.kune.gspace.client.viewers.FolderViewerPresenter;
@@ -101,8 +101,8 @@
bindPresenter(ToolSelectorPresenter.class, ToolSelectorPresenter.ToolSelectorView.class,
ToolSelectorPanel.class, ToolSelectorPresenter.ToolSelectorProxy.class);
bind(ToolSelector.class).to(ToolSelectorPresenter.class).in(Singleton.class);
- bindPresenter(DocViewerPresenter.class, DocViewerPresenter.DocViewerView.class,
- DocViewerPanel.class, DocViewerPresenter.DocViewerProxy.class);
+ bindPresenter(ContentViewerPresenter.class, ContentViewerPresenter.ContentViewerView.class,
+ ContentViewerPanel.class, ContentViewerPresenter.ContentViewerProxy.class);
bindPresenter(FolderViewerPresenter.class, FolderViewerPresenter.FolderViewerView.class,
FolderViewerAsTablePanel.class, FolderViewerPresenter.FolderViewerProxy.class);
bindPresenter(SitebarSearchPresenter.class, SitebarSearchPresenter.SitebarSearchView.class,
Modified: trunk/src/main/java/cc/kune/gspace/client/GSpaceGinjector.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/GSpaceGinjector.java 2011-05-05 21:20:17 UTC (rev 1348)
+++ trunk/src/main/java/cc/kune/gspace/client/GSpaceGinjector.java 2011-05-05 23:52:34 UTC (rev 1349)
@@ -5,7 +5,7 @@
import cc.kune.gspace.client.tool.ContentViewerSelector;
import cc.kune.gspace.client.tool.selector.ToolSelectorPresenter;
import cc.kune.gspace.client.ui.footer.license.EntityLicensePresenter;
-import cc.kune.gspace.client.viewers.DocViewerPresenter;
+import cc.kune.gspace.client.viewers.ContentViewerPresenter;
import cc.kune.gspace.client.viewers.FolderViewerPresenter;
import com.google.gwt.inject.client.AsyncProvider;
@@ -15,7 +15,7 @@
ContentViewerSelector getContentViewerSelector();
- AsyncProvider<DocViewerPresenter> getDocsViewerPresenter();
+ AsyncProvider<ContentViewerPresenter> getDocsViewerPresenter();
AsyncProvider<EntityLicensePresenter> getEntityLicensePresenter();
Modified: trunk/src/main/java/cc/kune/gspace/client/GSpaceParts.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/GSpaceParts.java 2011-05-05 21:20:17 UTC (rev 1348)
+++ trunk/src/main/java/cc/kune/gspace/client/GSpaceParts.java 2011-05-05 23:52:34 UTC (rev 1349)
@@ -19,7 +19,7 @@
import cc.kune.gspace.client.tags.TagsSummaryPresenter;
import cc.kune.gspace.client.tool.selector.ToolSelector;
import cc.kune.gspace.client.ui.footer.license.EntityLicensePresenter;
-import cc.kune.gspace.client.viewers.DocViewerPresenter;
+import cc.kune.gspace.client.viewers.ContentViewerPresenter;
import cc.kune.gspace.client.viewers.FolderViewerPresenter;
import com.google.inject.Inject;
@@ -30,7 +30,7 @@
@Inject
public GSpaceParts(final Session session, final Provider<EntityLicensePresenter> licenseFooter,
final Provider<TagsSummaryPresenter> tagsPresenter, final Provider<ToolSelector> toolSelector,
- final Provider<DocViewerPresenter> docsViewer, final Provider<FolderViewerPresenter> folderViewer,
+ final Provider<ContentViewerPresenter> docsViewer, final Provider<FolderViewerPresenter> folderViewer,
final Provider<GroupOptions> go, final Provider<UserOptions> uo,
final Provider<GroupOptionsCollection> goc, final Provider<UserOptionsCollection> uoc,
final Provider<GroupOptionsDefLicense> gdl, final Provider<GroupOptionsPublicSpaceConf> gps,
Copied: trunk/src/main/java/cc/kune/gspace/client/actions/ContentViewerOptionsMenu.java (from rev 1339, trunk/src/main/java/cc/kune/blogs/client/actions/ContentViewerOptionsMenu.java)
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/actions/ContentViewerOptionsMenu.java (rev 0)
+++ trunk/src/main/java/cc/kune/gspace/client/actions/ContentViewerOptionsMenu.java 2011-05-05 23:52:34 UTC (rev 1349)
@@ -0,0 +1,16 @@
+package cc.kune.gspace.client.actions;
+
+import cc.kune.common.client.actions.ui.descrip.MenuDescriptor;
+import cc.kune.core.client.resources.CoreResources;
+
+import com.google.inject.Inject;
+
+public class ContentViewerOptionsMenu extends MenuDescriptor {
+
+ @Inject
+ public ContentViewerOptionsMenu(final CoreResources res) {
+ super();
+ this.withIcon(res.arrowdownsitebar()).withStyles("k-def-docbtn, k-fr, k-noborder, k-nobackcolor");
+ }
+
+}
Added: trunk/src/main/java/cc/kune/gspace/client/actions/GotoTokenAction.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/actions/GotoTokenAction.java (rev 0)
+++ trunk/src/main/java/cc/kune/gspace/client/actions/GotoTokenAction.java 2011-05-05 23:52:34 UTC (rev 1349)
@@ -0,0 +1,66 @@
+/*
+ *
+ * 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.gspace.client.actions;
+
+import cc.kune.common.client.actions.AbstractExtendedAction;
+import cc.kune.common.client.actions.Action;
+import cc.kune.common.client.actions.ActionEvent;
+import cc.kune.core.client.events.RenameContentEvent;
+import cc.kune.core.client.state.SocialNetworkChangedEvent;
+import cc.kune.core.client.state.SocialNetworkChangedEvent.SocialNetworkChangedHandler;
+import cc.kune.core.client.state.StateManager;
+import cc.kune.core.shared.domain.utils.StateToken;
+
+import com.google.gwt.event.shared.EventBus;
+
+public class GotoTokenAction extends AbstractExtendedAction {
+ private final StateManager stateManager;
+ private final StateToken token;
+
+ public GotoTokenAction(final Object icon, final String name, final StateToken token,
+ final String style, final StateManager stateManager, final EventBus eventBus) {
+ super();
+ this.token = token;
+ this.stateManager = stateManager;
+ putValue(Action.NAME, name);
+ putValue(Action.SMALL_ICON, icon);
+ stateManager.onSocialNetworkChanged(true, new SocialNetworkChangedHandler() {
+ @Override
+ public void onSocialNetworkChanged(final SocialNetworkChangedEvent event) {
+ putValue(Action.STYLES, !token.equals(event.getState().getStateToken()) ? style : style
+ + ", k-button-disabled");
+ }
+ });
+ eventBus.addHandler(RenameContentEvent.getType(), new RenameContentEvent.RenameContentHandler() {
+ @Override
+ public void onRenameEvent(final RenameContentEvent event) {
+ final StateToken eToken = event.getToken();
+ if (eToken.equals(token)) {
+ putValue(Action.NAME, event.getNewName());
+ }
+ }
+ });
+ }
+
+ @Override
+ public void actionPerformed(final ActionEvent event) {
+ this.stateManager.gotoStateToken(token);
+ }
+}
Property changes on: trunk/src/main/java/cc/kune/gspace/client/actions/GotoTokenAction.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/src/main/java/cc/kune/gspace/client/actions/RefreshContentMenuItem.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/actions/RefreshContentMenuItem.java 2011-05-05 21:20:17 UTC (rev 1348)
+++ trunk/src/main/java/cc/kune/gspace/client/actions/RefreshContentMenuItem.java 2011-05-05 23:52:34 UTC (rev 1349)
@@ -1,6 +1,5 @@
package cc.kune.gspace.client.actions;
-import cc.kune.blogs.client.actions.ContentViewerOptionsMenu;
import cc.kune.common.client.actions.AbstractExtendedAction;
import cc.kune.common.client.actions.ActionEvent;
import cc.kune.common.client.actions.ui.descrip.MenuItemDescriptor;
Modified: trunk/src/main/java/cc/kune/gspace/client/actions/RenameAction.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/actions/RenameAction.java 2011-05-05 21:20:17 UTC (rev 1348)
+++ trunk/src/main/java/cc/kune/gspace/client/actions/RenameAction.java 2011-05-05 23:52:34 UTC (rev 1349)
@@ -23,12 +23,14 @@
import cc.kune.core.client.errors.ErrorHandler;
import cc.kune.core.client.errors.NameInUseException;
import cc.kune.core.client.errors.NameNotPermittedException;
+import cc.kune.core.client.events.RenameContentEvent;
import cc.kune.core.client.rpcservices.ContentServiceAsync;
import cc.kune.core.client.state.Session;
import cc.kune.core.shared.domain.utils.StateToken;
import cc.kune.core.shared.dto.StateAbstractDTO;
import cc.kune.core.shared.i18n.I18nTranslationService;
+import com.google.gwt.event.shared.EventBus;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.inject.Inject;
import com.google.inject.Provider;
@@ -36,14 +38,16 @@
public class RenameAction {
private final Provider<ContentServiceAsync> contentService;
private final ErrorHandler errorHandler;
+ private final EventBus eventBus;
private final I18nTranslationService i18n;
private final Session session;
@Inject
- public RenameAction(final I18nTranslationService i18n, final Session session,
+ public RenameAction(final I18nTranslationService i18n, final Session session, final EventBus eventBus,
final Provider<ContentServiceAsync> contentService, final ErrorHandler errorHandler) {
this.i18n = i18n;
this.session = session;
+ this.eventBus = eventBus;
this.contentService = contentService;
this.errorHandler = errorHandler;
}
@@ -74,6 +78,7 @@
NotifyUser.hideProgress();
session.setCurrentState(state);
listener.onSuccess(token, state.getTitle());
+ RenameContentEvent.fire(eventBus, token, oldName, newName);
}
};
if (token.isComplete()) {
Modified: trunk/src/main/java/cc/kune/gspace/client/options/logo/EntityOptionsLogoPresenter.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/options/logo/EntityOptionsLogoPresenter.java 2011-05-05 21:20:17 UTC (rev 1348)
+++ trunk/src/main/java/cc/kune/gspace/client/options/logo/EntityOptionsLogoPresenter.java 2011-05-05 23:52:34 UTC (rev 1349)
@@ -19,7 +19,6 @@
\*/
package cc.kune.gspace.client.options.logo;
-import cc.kune.chat.client.ChatClient;
import cc.kune.common.client.notify.NotifyUser;
import cc.kune.core.client.rpcservices.UserServiceAsync;
import cc.kune.core.client.state.Session;
@@ -31,47 +30,48 @@
import com.google.inject.Provider;
public abstract class EntityOptionsLogoPresenter implements GroupOptionsLogo, UserOptionsLogo {
- protected final Provider<ChatClient> chatEngine;
- private final EntityHeader entityLogo;
- private final EntityOptions entityOptions;
- protected final Session session;
- protected final Provider<UserServiceAsync> userService;
- protected EntityOptionsLogoView view;
+ private final EntityHeader entityLogo;
+ private final EntityOptions entityOptions;
+ protected final EventBus eventBus;
+ protected final Session session;
+ protected final Provider<UserServiceAsync> userService;
+ protected EntityOptionsLogoView view;
- public EntityOptionsLogoPresenter(final EventBus eventBus, final Session session, final EntityHeader entityLogo,
- final EntityOptions entityOptions, final Provider<UserServiceAsync> userService,
- final Provider<ChatClient> chatEngine) {
- this.session = session;
- this.entityLogo = entityLogo;
- this.entityOptions = entityOptions;
- this.userService = userService;
- this.chatEngine = chatEngine;
- eventBus.addHandler(CurrentLogoChangedEvent.getType(), new CurrentLogoChangedEvent.CurrentLogoChangedHandler() {
- @Override
- public void onCurrentLogoChanged(final CurrentLogoChangedEvent event) {
- onSubmitComplete();
- }
+ public EntityOptionsLogoPresenter(final EventBus eventBus, final Session session,
+ final EntityHeader entityLogo, final EntityOptions entityOptions,
+ final Provider<UserServiceAsync> userService) {
+ this.eventBus = eventBus;
+ this.session = session;
+ this.entityLogo = entityLogo;
+ this.entityOptions = entityOptions;
+ this.userService = userService;
+ eventBus.addHandler(CurrentLogoChangedEvent.getType(),
+ new CurrentLogoChangedEvent.CurrentLogoChangedHandler() {
+ @Override
+ public void onCurrentLogoChanged(final CurrentLogoChangedEvent event) {
+ onSubmitComplete();
+ }
});
- }
+ }
- public IsWidget getView() {
- return view;
- }
+ public IsWidget getView() {
+ return view;
+ }
- protected void init(final EntityOptionsLogoView view) {
- this.view = view;
- entityOptions.addTab(view, view.getTabTitle());
- setState();
- }
+ protected void init(final EntityOptionsLogoView view) {
+ this.view = view;
+ entityOptions.addTab(view, view.getTabTitle());
+ setState();
+ }
- public void onSubmitComplete() {
- entityLogo.reloadGroupLogoImage();
- }
+ public void onSubmitComplete() {
+ entityLogo.reloadGroupLogoImage();
+ }
- public void onSubmitFailed(final int httpStatus, final String responseText) {
- NotifyUser.error("Error setting the logo: " + responseText);
- }
+ public void onSubmitFailed(final int httpStatus, final String responseText) {
+ NotifyUser.error("Error setting the logo: " + responseText);
+ }
- protected abstract void setState();
+ protected abstract void setState();
}
Modified: trunk/src/main/java/cc/kune/gspace/client/options/logo/GroupOptionsLogoPresenter.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/options/logo/GroupOptionsLogoPresenter.java 2011-05-05 21:20:17 UTC (rev 1348)
+++ trunk/src/main/java/cc/kune/gspace/client/options/logo/GroupOptionsLogoPresenter.java 2011-05-05 23:52:34 UTC (rev 1349)
@@ -19,7 +19,6 @@
*/
package cc.kune.gspace.client.options.logo;
-import cc.kune.chat.client.ChatClient;
import cc.kune.core.client.rpcservices.UserServiceAsync;
import cc.kune.core.client.state.GroupChangedEvent;
import cc.kune.core.client.state.GroupChangedEvent.GroupChangedHandler;
@@ -34,28 +33,27 @@
public class GroupOptionsLogoPresenter extends EntityOptionsLogoPresenter {
- @Inject
- public GroupOptionsLogoPresenter(final EventBus eventBus, final Session session, final EntityHeader entityLogo,
- final GroupOptions entityOptions, final StateManager stateManager,
- final Provider<UserServiceAsync> userService, final Provider<ChatClient> chatEngine,
- final GroupOptionsLogoView view) {
- super(eventBus, session, entityLogo, entityOptions, userService, chatEngine);
- init(view);
- stateManager.onGroupChanged(true, new GroupChangedHandler() {
- @Override
- public void onGroupChanged(final GroupChangedEvent event) {
- setState();
- }
- });
- }
+ @Inject
+ public GroupOptionsLogoPresenter(final EventBus eventBus, final Session session,
+ final EntityHeader entityLogo, final GroupOptions entityOptions, final StateManager stateManager,
+ final Provider<UserServiceAsync> userService, final GroupOptionsLogoView view) {
+ super(eventBus, session, entityLogo, entityOptions, userService);
+ init(view);
+ stateManager.onGroupChanged(true, new GroupChangedHandler() {
+ @Override
+ public void onGroupChanged(final GroupChangedEvent event) {
+ setState();
+ }
+ });
+ }
- private void init(final GroupOptionsLogoView view) {
- super.init(view);
- view.setNormalGroupsLabels();
- }
+ private void init(final GroupOptionsLogoView view) {
+ super.init(view);
+ view.setNormalGroupsLabels();
+ }
- @Override
- protected void setState() {
- view.setUploadParams(session.getUserHash(), session.getCurrentStateToken().toString());
- }
+ @Override
+ protected void setState() {
+ view.setUploadParams(session.getUserHash(), session.getCurrentStateToken().toString());
+ }
}
Modified: trunk/src/main/java/cc/kune/gspace/client/options/logo/UserOptionsLogoPresenter.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/options/logo/UserOptionsLogoPresenter.java 2011-05-05 21:20:17 UTC (rev 1348)
+++ trunk/src/main/java/cc/kune/gspace/client/options/logo/UserOptionsLogoPresenter.java 2011-05-05 23:52:34 UTC (rev 1349)
@@ -19,7 +19,7 @@
*/
package cc.kune.gspace.client.options.logo;
-import cc.kune.chat.client.ChatClient;
+import cc.kune.core.client.events.AvatarChangedEvent;
import cc.kune.core.client.rpcservices.AsyncCallbackSimple;
import cc.kune.core.client.rpcservices.UserServiceAsync;
import cc.kune.core.client.state.Session;
@@ -36,43 +36,42 @@
public class UserOptionsLogoPresenter extends EntityOptionsLogoPresenter {
- @Inject
- public UserOptionsLogoPresenter(final EventBus eventBus, final Session session, final EntityHeader entityLogo,
- final UserOptions entityOptions, final StateManager stateManager,
- final Provider<UserServiceAsync> userService, final Provider<ChatClient> chatEngine,
- final UserOptionsLogoView view) {
- super(eventBus, session, entityLogo, entityOptions, userService, chatEngine);
- init(view);
- session.onUserSignIn(true, new UserSignInHandler() {
+ @Inject
+ public UserOptionsLogoPresenter(final EventBus eventBus, final Session session,
+ final EntityHeader entityLogo, final UserOptions entityOptions, final StateManager stateManager,
+ final Provider<UserServiceAsync> userService, final UserOptionsLogoView view) {
+ super(eventBus, session, entityLogo, entityOptions, userService);
+ init(view);
+ session.onUserSignIn(true, new UserSignInHandler() {
+ @Override
+ public void onUserSignIn(final UserSignInEvent event) {
+ setState();
+ }
+ });
+ }
+
+ private void init(final UserOptionsLogoView view) {
+ super.init(view);
+ view.setPersonalGroupsLabels();
+ }
+
+ @Override
+ public void onSubmitComplete() {
+ super.onSubmitComplete();
+ final GroupDTO group = session.getCurrentState().getGroup();
+ if (session.getCurrentUser().getShortName().equals(group.getShortName())) {
+ userService.get().getUserAvatarBaser64(session.getUserHash(), group.getStateToken(),
+ new AsyncCallbackSimple<String>() {
@Override
- public void onUserSignIn(final UserSignInEvent event) {
- setState();
+ public void onSuccess(final String photoBinary) {
+ AvatarChangedEvent.fire(eventBus, photoBinary);
}
- });
+ });
}
+ }
- private void init(final UserOptionsLogoView view) {
- super.init(view);
- view.setPersonalGroupsLabels();
- }
-
- @Override
- public void onSubmitComplete() {
- super.onSubmitComplete();
- final GroupDTO group = session.getCurrentState().getGroup();
- if (session.getCurrentUser().getShortName().equals(group.getShortName())) {
- userService.get().getUserAvatarBaser64(session.getUserHash(), group.getStateToken(),
- new AsyncCallbackSimple<String>() {
- @Override
- public void onSuccess(final String photoBinary) {
- chatEngine.get().setAvatar(photoBinary);
- }
- });
- }
- }
-
- @Override
- protected void setState() {
- view.setUploadParams(session.getUserHash(), session.getCurrentUser().getStateToken().toString());
- }
+ @Override
+ protected void setState() {
+ view.setUploadParams(session.getUserHash(), session.getCurrentUser().getStateToken().toString());
+ }
}
Modified: trunk/src/main/java/cc/kune/gspace/client/resources/wsArmor.css
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/resources/wsArmor.css 2011-05-05 21:20:17 UTC (rev 1348)
+++ trunk/src/main/java/cc/kune/gspace/client/resources/wsArmor.css 2011-05-05 23:52:34 UTC (rev 1349)
@@ -92,15 +92,15 @@
}
.docSubheader button.k-fr {
- margin: 0 10px 0 0;
+ margin: 0 5px 0 0;
}
.docSubheader button.k-fl {
- margin: 0 0 0 10px;
+ margin: 0 0 0 5px;
}
.docSubheader button {
- margin: 0 0 0 10px;
+ margin: 0 0 0 5px;
}
.docSubheaderLeft {
Copied: trunk/src/main/java/cc/kune/gspace/client/viewers/ContentViewerPanel.java (from rev 1339, trunk/src/main/java/cc/kune/gspace/client/viewers/DocViewerPanel.java)
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/viewers/ContentViewerPanel.java (rev 0)
+++ trunk/src/main/java/cc/kune/gspace/client/viewers/ContentViewerPanel.java 2011-05-05 23:52:34 UTC (rev 1349)
@@ -0,0 +1,202 @@
+package cc.kune.gspace.client.viewers;
+
+import org.waveprotocol.box.webclient.client.ClientIdGenerator;
+import org.waveprotocol.box.webclient.client.RemoteViewServiceMultiplexer;
+import org.waveprotocol.box.webclient.client.Session;
+import org.waveprotocol.box.webclient.client.SimpleWaveStore;
+import org.waveprotocol.box.webclient.client.StagesProvider;
+import org.waveprotocol.box.webclient.client.WaveWebSocketClient;
+import org.waveprotocol.box.webclient.search.WaveStore;
+import org.waveprotocol.box.webclient.widget.loading.LoadingIndicator;
+import org.waveprotocol.wave.client.account.ProfileManager;
+import org.waveprotocol.wave.client.account.impl.ProfileManagerImpl;
+import org.waveprotocol.wave.client.widget.common.ImplPanel;
+import org.waveprotocol.wave.model.id.IdGenerator;
+import org.waveprotocol.wave.model.wave.ParticipantId;
+import org.waveprotocol.wave.model.waveref.InvalidWaveRefException;
+import org.waveprotocol.wave.model.waveref.WaveRef;
+import org.waveprotocol.wave.util.escapers.GwtWaverefEncoder;
+
+import cc.kune.common.client.actions.ui.descrip.GuiActionDescCollection;
+import cc.kune.common.client.errors.UIException;
+import cc.kune.common.client.ui.HasEditHandler;
+import cc.kune.common.client.ui.UiUtils;
+import cc.kune.core.client.registry.ContentCapabilitiesRegistry;
+import cc.kune.core.shared.dto.StateContentDTO;
+import cc.kune.core.shared.i18n.I18nTranslationService;
+import cc.kune.gspace.client.GSpaceArmor;
+import cc.kune.gspace.client.viewers.ContentViewerPresenter.ContentViewerView;
+import cc.kune.wave.client.WaveClientManager;
+import cc.kune.wave.client.WebClient;
+
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.dom.client.Document;
+import com.google.gwt.dom.client.Element;
+import com.google.gwt.safehtml.shared.SafeHtmlUtils;
+import com.google.gwt.uibinder.client.UiBinder;
+import com.google.gwt.uibinder.client.UiField;
+import com.google.gwt.user.client.Command;
+import com.google.gwt.user.client.ui.DeckPanel;
+import com.google.gwt.user.client.ui.InlineHTML;
+import com.google.gwt.user.client.ui.InsertPanel.ForIsWidget;
+import com.google.gwt.user.client.ui.Widget;
+import com.google.inject.Inject;
+import com.gwtplatform.mvp.client.ViewImpl;
+
+public class ContentViewerPanel extends ViewImpl implements ContentViewerView {
+ interface DocsViewerPanelUiBinder extends UiBinder<Widget, ContentViewerPanel> {
+ }
+
+ private static final RemoteViewServiceMultiplexer NO_CHANNEL = null;
+
+ private static DocsViewerPanelUiBinder uiBinder = GWT.create(DocsViewerPanelUiBinder.class);
+
+ private final ContentCapabilitiesRegistry capabilitiesRegistry;
+ private RemoteViewServiceMultiplexer channel;
+ private final ContentTitleWidget contentTitle;
+ @UiField
+ DeckPanel deck;
+ private final GSpaceArmor gsArmor;
+ private IdGenerator idGenerator;
+ private final Element loading = new LoadingIndicator().getElement();
+ @UiField
+ InlineHTML onlyViewPanel;
+ private ProfileManager profiles;
+ /** The wave panel, if a wave is open. */
+ private StagesProvider wave;
+ private final WaveClientManager waveClient;
+ @UiField
+ ImplPanel waveHolder;
+
+ private final WaveStore waveStore = new SimpleWaveStore();
+
+ private final Widget widget;
+
+ @Inject
+ public ContentViewerPanel(final GSpaceArmor wsArmor, final WaveClientManager waveClient,
+ final ContentCapabilitiesRegistry capabilitiesRegistry, final I18nTranslationService i18n) {
+ this.gsArmor = wsArmor;
+ this.waveClient = waveClient;
+ this.capabilitiesRegistry = capabilitiesRegistry;
+ widget = uiBinder.createAndBindUi(this);
+ contentTitle = new ContentTitleWidget(i18n, gsArmor, capabilitiesRegistry.getIconsRegistry());
+ loading.addClassName("kune-Margin-40-tb");
+ }
+
+ @Override
+ public Widget asWidget() {
+ return widget;
+ }
+
+ @Override
+ public void attach() {
+ final ForIsWidget docContainer = gsArmor.getDocContainer();
+ docContainer.add(widget);
+ }
+
+ @Override
+ public void clear() {
+ onlyViewPanel.setHTML("");
+ gsArmor.getSubheaderToolbar().clear();
+ UiUtils.clear(gsArmor.getDocContainer());
+ UiUtils.clear(gsArmor.getDocHeader());
+ }
+
+ @Override
+ public void detach() {
+ clear();
+ }
+
+ @Override
+ public HasEditHandler getEditTitle() {
+ return contentTitle.getEditableTitle();
+ }
+
+ private WaveRef getWaveRef(final String waveRefS) {
+ try {
+ return GwtWaverefEncoder.decodeWaveRefFromPath(waveRefS);
+ } catch (final InvalidWaveRefException e) {
+ throw new UIException("Invalid waveref: " + waveRefS);
+ }
+ }
+
+ private void initWaveClientIfNeeded() {
+ if (channel == null) {
+ final WaveWebSocketClient webSocket = new WaveWebSocketClient(WebClient.useSocketIO(),
+ WebClient.getWebSocketBaseUrl(GWT.getModuleBaseURL()));
+ webSocket.connect();
+ channel = new RemoteViewServiceMultiplexer(webSocket,
+ new ParticipantId(Session.get().getAddress()).getAddress());
+ profiles = new ProfileManagerImpl(Session.get().getDomain());
+ idGenerator = ClientIdGenerator.create();
+ }
+ }
+
+ @Override
+ public void setActions(final GuiActionDescCollection actions) {
+ gsArmor.getSubheaderToolbar().clear();
+ gsArmor.getSubheaderToolbar().addAll(actions);
+ }
+
+ @Override
+ public void setContent(final StateContentDTO state) {
+ final boolean editable = state.getContentRights().isEditable();
+ setTitle(state, editable);
+ onlyViewPanel.setHTML(SafeHtmlUtils.fromTrustedString(state.getContent()));
+ deck.showWidget(1);
+ }
+
+ @Override
+ public void setEditableContent(final StateContentDTO state) {
+ setTitle(state, true);
+ setEditableWaveContent(state.getWaveRef(), false);
+ deck.showWidget(0);
+ }
+
+ @Override
+ public void setEditableTitle(final String title) {
+ contentTitle.setText(title);
+ }
+
+ private void setEditableWaveContent(final String waveRefS, final boolean isNewWave) {
+ final WaveRef waveRef = getWaveRef(waveRefS);
+
+ if (wave != null) {
+ wave.destroy();
+ wave = null;
+ }
+
+ initWaveClientIfNeeded();
+
+ // Release the display:none.
+ // UIObject.setVisible(waveFrame.getElement(), true);
+ waveHolder.getElement().appendChild(loading);
+ final Element holder = waveHolder.getElement().appendChild(Document.get().createDivElement());
+ final StagesProvider wave = new StagesProvider(holder, waveHolder, waveRef, channel, idGenerator,
+ profiles, waveStore, isNewWave);
+ this.wave = wave;
+ wave.load(new Command() {
+ @Override
+ public void execute() {
+ loading.removeFromParent();
+ }
+ });
+ }
+
+ private void setTitle(final StateContentDTO state, final boolean editable) {
+ contentTitle.setTitle(state.getTitle(), state.getTypeId(), state.getMimeType(), editable
+ && capabilitiesRegistry.isRenamable(state.getTypeId()));
+ }
+
+ @Override
+ public void signIn() {
+ // Do nothing (now)
+ // initWaveClientIfNeeded();
+ }
+
+ @Override
+ public void signOut() {
+ channel = NO_CHANNEL;
+ }
+
+}
Copied: trunk/src/main/java/cc/kune/gspace/client/viewers/ContentViewerPanel.ui.xml (from rev 1339, trunk/src/main/java/cc/kune/gspace/client/viewers/DocViewerPanel.ui.xml)
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/viewers/ContentViewerPanel.ui.xml (rev 0)
+++ trunk/src/main/java/cc/kune/gspace/client/viewers/ContentViewerPanel.ui.xml 2011-05-05 23:52:34 UTC (rev 1349)
@@ -0,0 +1,28 @@
+<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
+<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
+ xmlns:g='urn:import:com.google.gwt.user.client.ui' xmlns:f='urn:import:org.waveprotocol.box.webclient.widget.frame'
+ xmlns:w='urn:import:org.waveprotocol.wave.client.widget.common'>
+ <ui:style>
+ .wavePanel {
+ margin: 0 0 0 0;
+ }
+
+ .waveHolder {
+ position: absolute;
+ top: 0;
+ bottom: 0;
+ left: 0;
+ right: 0;
+ }
+
+ .viewonly {
+ margin: 5px;
+ }
+ </ui:style>
+ <g:HTMLPanel width="100%" height="100%">
+ <g:DeckPanel ui:field="deck" addStyleNames="k-doc-content-deck">
+ <w:ImplPanel ui:field="waveHolder" addStyleNames="{style.waveHolder}" />
+ <g:InlineHTML ui:field="onlyViewPanel" styleName="{style.viewonly}" />
+ </g:DeckPanel>
+ </g:HTMLPanel>
+</ui:UiBinder>
\ No newline at end of file
Copied: trunk/src/main/java/cc/kune/gspace/client/viewers/ContentViewerPresenter.java (from rev 1339, trunk/src/main/java/cc/kune/gspace/client/viewers/DocViewerPresenter.java)
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/viewers/ContentViewerPresenter.java (rev 0)
+++ trunk/src/main/java/cc/kune/gspace/client/viewers/ContentViewerPresenter.java 2011-05-05 23:52:34 UTC (rev 1349)
@@ -0,0 +1,163 @@
+package cc.kune.gspace.client.viewers;
+
+import javax.annotation.Nonnull;
+
+import cc.kune.common.client.actions.ui.descrip.GuiActionDescCollection;
+import cc.kune.common.client.errors.UIException;
+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.state.Session;
+import cc.kune.core.client.state.UserSignInEvent;
+import cc.kune.core.client.state.UserSignInEvent.UserSignInHandler;
+import cc.kune.core.client.state.UserSignOutEvent;
+import cc.kune.core.client.state.UserSignOutEvent.UserSignOutHandler;
+import cc.kune.core.shared.domain.utils.AccessRights;
+import cc.kune.core.shared.domain.utils.StateToken;
+import cc.kune.core.shared.dto.HasContent;
+import cc.kune.core.shared.dto.StateContentDTO;
+import cc.kune.gspace.client.actions.ActionGroups;
+import cc.kune.gspace.client.actions.RenameAction;
+import cc.kune.gspace.client.actions.RenameListener;
+import cc.kune.gspace.client.tool.ContentViewer;
+
+import com.google.gwt.event.shared.EventBus;
+import com.google.gwt.event.shared.HandlerRegistration;
+import com.google.inject.Inject;
+import com.google.inject.Provider;
+import com.gwtplatform.mvp.client.Presenter;
+import com.gwtplatform.mvp.client.View;
+import com.gwtplatform.mvp.client.annotations.ProxyCodeSplit;
+import com.gwtplatform.mvp.client.proxy.Proxy;
+import com.gwtplatform.mvp.client.proxy.RevealRootContentEvent;
+
+public class ContentViewerPresenter extends
+ Presenter<ContentViewerPresenter.ContentViewerView, ContentViewerPresenter.ContentViewerProxy>
+ implements ContentViewer {
+
+ @ProxyCodeSplit
+ public interface ContentViewerProxy extends Proxy<ContentViewerPresenter> {
+ }
+
+ public interface ContentViewerView extends View {
+
+ void attach();
+
+ void clear();
+
+ void detach();
+
+ HasEditHandler getEditTitle();
+
+ void setActions(GuiActionDescCollection actions);
+
+ void setContent(StateContentDTO state);
+
+ void setEditableContent(StateContentDTO state);
+
+ void setEditableTitle(String title);
+
+ void signIn();
+
+ void signOut();
+ }
+
+ private final ActionRegistryByType actionsRegistry;
+ private HandlerRegistration editHandler;
+ 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) {
+ super(eventBus, view, proxy);
+ this.session = session;
+ this.actionsRegistry = actionsRegistry;
+ this.renameAction = renameAction;
+ session.onUserSignOut(true, new UserSignOutHandler() {
+ @Override
+ public void onUserSignOut(final UserSignOutEvent event) {
+ getView().signOut();
+ }
+ });
+ session.onUserSignIn(true, new UserSignInHandler() {
+
+ @Override
+ public void onUserSignIn(final UserSignInEvent event) {
+ getView().signIn();
+ }
+ });
+
+ }
+
+ @Override
+ public void attach() {
+ getView().attach();
+ if (editHandler == null) {
+ createEditHandler();
+ }
+ }
+
+ private void createEditHandler() {
+ editHandler = getView().getEditTitle().addEditHandler(new EditHandler() {
+ @Override
+ public void fire(final EditEvent event) {
+ renameAction.get().rename(session.getCurrentStateToken(), session.getCurrentState().getTitle(),
+ event.getText(), new RenameListener() {
+ @Override
+ public void onFail(final StateToken token, final String oldTitle) {
+ getView().setEditableTitle(oldTitle);
+ }
+
+ @Override
+ public void onSuccess(final StateToken token, final String title) {
+ getView().setEditableTitle(title);
+ }
+ });
+ }
+ });
+ }
+
+ @Override
+ public void detach() {
+ getView().detach();
+ }
+
+ @Override
+ protected void revealInParent() {
+ RevealRootContentEvent.fire(this, this);
+ }
+
+ @Override
+ public void setContent(@Nonnull final HasContent state) {
+ getView().clear();
+ final StateContentDTO stateContent = (StateContentDTO) state;
+ final AccessRights rights = stateContent.getContentRights();
+ if (session.isLogged() && rights.isEditable()) {
+ if (stateContent.isParticipant()) {
+ // is already participant, show wave editor
+ if (org.waveprotocol.box.webclient.client.Session.get().isLoggedIn()) {
+ getView().setEditableContent(stateContent);
+ } else {
+ getView().setContent(stateContent);
+ // When logged setEditable!
+ }
+ } else {
+ // add "participate" action
+ getView().setContent(stateContent);
+ }
+ } else {
+ if (rights.isVisible()) {
+ // Show contents
+ getView().setContent(stateContent);
+ } else {
+ throw new UIException("Unexpected status in Viewer");
+ }
+ }
+ final GuiActionDescCollection actions = actionsRegistry.getCurrentActions(stateContent.getGroup(),
+ stateContent.getTypeId(), session.isLogged(), rights, ActionGroups.VIEW);
+ getView().setActions(actions);
+ }
+}
\ No newline at end of file
Deleted: trunk/src/main/java/cc/kune/gspace/client/viewers/DocViewerPanel.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/viewers/DocViewerPanel.java 2011-05-05 21:20:17 UTC (rev 1348)
+++ trunk/src/main/java/cc/kune/gspace/client/viewers/DocViewerPanel.java 2011-05-05 23:52:34 UTC (rev 1349)
@@ -1,202 +0,0 @@
-package cc.kune.gspace.client.viewers;
-
-import org.waveprotocol.box.webclient.client.ClientIdGenerator;
-import org.waveprotocol.box.webclient.client.RemoteViewServiceMultiplexer;
-import org.waveprotocol.box.webclient.client.Session;
-import org.waveprotocol.box.webclient.client.SimpleWaveStore;
-import org.waveprotocol.box.webclient.client.StagesProvider;
-import org.waveprotocol.box.webclient.client.WaveWebSocketClient;
-import org.waveprotocol.box.webclient.search.WaveStore;
-import org.waveprotocol.box.webclient.widget.loading.LoadingIndicator;
-import org.waveprotocol.wave.client.account.ProfileManager;
-import org.waveprotocol.wave.client.account.impl.ProfileManagerImpl;
-import org.waveprotocol.wave.client.widget.common.ImplPanel;
-import org.waveprotocol.wave.model.id.IdGenerator;
-import org.waveprotocol.wave.model.wave.ParticipantId;
-import org.waveprotocol.wave.model.waveref.InvalidWaveRefException;
-import org.waveprotocol.wave.model.waveref.WaveRef;
-import org.waveprotocol.wave.util.escapers.GwtWaverefEncoder;
-
-import cc.kune.common.client.actions.ui.descrip.GuiActionDescCollection;
-import cc.kune.common.client.errors.UIException;
-import cc.kune.common.client.ui.HasEditHandler;
-import cc.kune.common.client.ui.UiUtils;
-import cc.kune.core.client.registry.ContentCapabilitiesRegistry;
-import cc.kune.core.shared.dto.StateContentDTO;
-import cc.kune.core.shared.i18n.I18nTranslationService;
-import cc.kune.gspace.client.GSpaceArmor;
-import cc.kune.gspace.client.viewers.DocViewerPresenter.DocViewerView;
-import cc.kune.wave.client.WaveClientManager;
-import cc.kune.wave.client.WebClient;
-
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.dom.client.Document;
-import com.google.gwt.dom.client.Element;
-import com.google.gwt.safehtml.shared.SafeHtmlUtils;
-import com.google.gwt.uibinder.client.UiBinder;
-import com.google.gwt.uibinder.client.UiField;
-import com.google.gwt.user.client.Command;
-import com.google.gwt.user.client.ui.DeckPanel;
-import com.google.gwt.user.client.ui.InlineHTML;
-import com.google.gwt.user.client.ui.InsertPanel.ForIsWidget;
-import com.google.gwt.user.client.ui.Widget;
-import com.google.inject.Inject;
-import com.gwtplatform.mvp.client.ViewImpl;
-
-public class DocViewerPanel extends ViewImpl implements DocViewerView {
- interface DocsViewerPanelUiBinder extends UiBinder<Widget, DocViewerPanel> {
- }
-
- private static final RemoteViewServiceMultiplexer NO_CHANNEL = null;
-
- private static DocsViewerPanelUiBinder uiBinder = GWT.create(DocsViewerPanelUiBinder.class);
-
- private final ContentCapabilitiesRegistry capabilitiesRegistry;
- private RemoteViewServiceMultiplexer channel;
- private final ContentTitleWidget contentTitle;
- @UiField
- DeckPanel deck;
- private final GSpaceArmor gsArmor;
- private IdGenerator idGenerator;
- private final Element loading = new LoadingIndicator().getElement();
- @UiField
- InlineHTML onlyViewPanel;
- private ProfileManager profiles;
- /** The wave panel, if a wave is open. */
- private StagesProvider wave;
- private final WaveClientManager waveClient;
- @UiField
- ImplPanel waveHolder;
-
- private final WaveStore waveStore = new SimpleWaveStore();
-
- private final Widget widget;
-
- @Inject
- public DocViewerPanel(final GSpaceArmor wsArmor, final WaveClientManager waveClient,
- final ContentCapabilitiesRegistry capabilitiesRegistry, final I18nTranslationService i18n) {
- this.gsArmor = wsArmor;
- this.waveClient = waveClient;
- this.capabilitiesRegistry = capabilitiesRegistry;
- widget = uiBinder.createAndBindUi(this);
- contentTitle = new ContentTitleWidget(i18n, gsArmor, capabilitiesRegistry.getIconsRegistry());
- loading.addClassName("kune-Margin-40-tb");
- }
-
- @Override
- public Widget asWidget() {
- return widget;
- }
-
- @Override
- public void attach() {
- final ForIsWidget docContainer = gsArmor.getDocContainer();
- docContainer.add(widget);
- }
-
- @Override
- public void clear() {
- onlyViewPanel.setHTML("");
- gsArmor.getSubheaderToolbar().clear();
- UiUtils.clear(gsArmor.getDocContainer());
- UiUtils.clear(gsArmor.getDocHeader());
- }
-
- @Override
- public void detach() {
- clear();
- }
-
- @Override
- public HasEditHandler getEditTitle() {
- return contentTitle.getEditableTitle();
- }
-
- private WaveRef getWaveRef(final String waveRefS) {
- try {
- return GwtWaverefEncoder.decodeWaveRefFromPath(waveRefS);
- } catch (final InvalidWaveRefException e) {
- throw new UIException("Invalid waveref: " + waveRefS);
- }
- }
-
- private void initWaveClientIfNeeded() {
- if (channel == null) {
- final WaveWebSocketClient webSocket = new WaveWebSocketClient(WebClient.useSocketIO(),
- WebClient.getWebSocketBaseUrl(GWT.getModuleBaseURL()));
- webSocket.connect();
- channel = new RemoteViewServiceMultiplexer(webSocket,
- new ParticipantId(Session.get().getAddress()).getAddress());
- profiles = new ProfileManagerImpl(Session.get().getDomain());
- idGenerator = ClientIdGenerator.create();
- }
- }
-
- @Override
- public void setActions(final GuiActionDescCollection actions) {
- gsArmor.getSubheaderToolbar().clear();
- gsArmor.getSubheaderToolbar().addAll(actions);
- }
-
- @Override
- public void setContent(final StateContentDTO state) {
- final boolean editable = state.getContentRights().isEditable();
- setTitle(state, editable);
- onlyViewPanel.setHTML(SafeHtmlUtils.fromTrustedString(state.getContent()));
- deck.showWidget(1);
- }
-
- @Override
- public void setEditableContent(final StateContentDTO state) {
- setTitle(state, true);
- setEditableWaveContent(state.getWaveRef(), false);
- deck.showWidget(0);
- }
-
- @Override
- public void setEditableTitle(final String title) {
- contentTitle.setText(title);
- }
-
- private void setEditableWaveContent(final String waveRefS, final boolean isNewWave) {
- final WaveRef waveRef = getWaveRef(waveRefS);
-
- if (wave != null) {
- wave.destroy();
- wave = null;
- }
-
- initWaveClientIfNeeded();
-
- // Release the display:none.
- // UIObject.setVisible(waveFrame.getElement(), true);
- waveHolder.getElement().appendChild(loading);
- final Element holder = waveHolder.getElement().appendChild(Document.get().createDivElement());
- final StagesProvider wave = new StagesProvider(holder, waveHolder, waveRef, channel, idGenerator,
- profiles, waveStore, isNewWave);
- this.wave = wave;
- wave.load(new Command() {
- @Override
- public void execute() {
- loading.removeFromParent();
- }
- });
- }
-
- private void setTitle(final StateContentDTO state, final boolean editable) {
- contentTitle.setTitle(state.getTitle(), state.getTypeId(), state.getMimeType(), editable
- && capabilitiesRegistry.isRenamable(state.getTypeId()));
- }
-
- @Override
- public void signIn() {
- // Do nothing (now)
- // initWaveClientIfNeeded();
- }
-
- @Override
- public void signOut() {
- channel = NO_CHANNEL;
- }
-
-}
Deleted: trunk/src/main/java/cc/kune/gspace/client/viewers/DocViewerPanel.ui.xml
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/viewers/DocViewerPanel.ui.xml 2011-05-05 21:20:17 UTC (rev 1348)
+++ trunk/src/main/java/cc/kune/gspace/client/viewers/DocViewerPanel.ui.xml 2011-05-05 23:52:34 UTC (rev 1349)
@@ -1,28 +0,0 @@
-<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
-<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
- xmlns:g='urn:import:com.google.gwt.user.client.ui' xmlns:f='urn:import:org.waveprotocol.box.webclient.widget.frame'
- xmlns:w='urn:import:org.waveprotocol.wave.client.widget.common'>
- <ui:style>
- .wavePanel {
- margin: 0 0 0 0;
- }
-
- .waveHolder {
- position: absolute;
- top: 0;
- bottom: 0;
- left: 0;
- right: 0;
- }
-
- .viewonly {
- margin: 5px;
- }
- </ui:style>
- <g:HTMLPanel width="100%" height="100%">
- <g:DeckPanel ui:field="deck" addStyleNames="k-doc-content-deck">
- <w:ImplPanel ui:field="waveHolder" addStyleNames="{style.waveHolder}" />
- <g:InlineHTML ui:field="onlyViewPanel" styleName="{style.viewonly}" />
- </g:DeckPanel>
- </g:HTMLPanel>
-</ui:UiBinder>
\ No newline at end of file
Deleted: trunk/src/main/java/cc/kune/gspace/client/viewers/DocViewerPresenter.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/viewers/DocViewerPresenter.java 2011-05-05 21:20:17 UTC (rev 1348)
+++ trunk/src/main/java/cc/kune/gspace/client/viewers/DocViewerPresenter.java 2011-05-05 23:52:34 UTC (rev 1349)
@@ -1,171 +0,0 @@
-package cc.kune.gspace.client.viewers;
-
-import javax.annotation.Nonnull;
-
-import cc.kune.blogs.client.actions.BlogsClientActions;
-import cc.kune.blogs.shared.BlogsConstants;
-import cc.kune.common.client.actions.ui.descrip.GuiActionDescCollection;
-import cc.kune.common.client.errors.UIException;
-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.state.Session;
-import cc.kune.core.client.state.UserSignInEvent;
-import cc.kune.core.client.state.UserSignInEvent.UserSignInHandler;
-import cc.kune.core.client.state.UserSignOutEvent;
-import cc.kune.core.client.state.UserSignOutEvent.UserSignOutHandler;
-import cc.kune.core.shared.domain.utils.AccessRights;
-import cc.kune.core.shared.domain.utils.StateToken;
-import cc.kune.core.shared.dto.HasContent;
-import cc.kune.core.shared.dto.StateContentDTO;
-import cc.kune.docs.client.actions.DocsClientActions;
-import cc.kune.docs.shared.DocsConstants;
-import cc.kune.gspace.client.actions.ActionGroups;
-import cc.kune.gspace.client.actions.RenameAction;
-import cc.kune.gspace.client.actions.RenameListener;
-import cc.kune.gspace.client.tool.ContentViewer;
-import cc.kune.gspace.client.tool.ContentViewerSelector;
-
-import com.google.gwt.event.shared.EventBus;
-import com.google.gwt.event.shared.HandlerRegistration;
-import com.google.inject.Inject;
-import com.google.inject.Provider;
-import com.gwtplatform.mvp.client.Presenter;
-import com.gwtplatform.mvp.client.View;
-import com.gwtplatform.mvp.client.annotations.ProxyCodeSplit;
-import com.gwtplatform.mvp.client.proxy.Proxy;
-import com.gwtplatform.mvp.client.proxy.RevealRootContentEvent;
-
-public class DocViewerPresenter extends
- Presenter<DocViewerPresenter.DocViewerView, DocViewerPresenter.DocViewerProxy> implements
- ContentViewer {
-
- @ProxyCodeSplit
- public interface DocViewerProxy extends Proxy<DocViewerPresenter> {
- }
-
- public interface DocViewerView extends View {
-
- void attach();
-
- void clear();
-
- void detach();
-
- HasEditHandler getEditTitle();
-
- void setActions(GuiActionDescCollection actions);
-
- void setContent(StateContentDTO state);
-
- void setEditableContent(StateContentDTO state);
-
- void setEditableTitle(String title);
-
- void signIn();
-
- void signOut();
- }
-
- private final ActionRegistryByType actionsRegistry;
- private HandlerRegistration editHandler;
- private final Provider<RenameAction> renameAction;
- private final Session session;
-
- @Inject
- public DocViewerPresenter(final EventBus eventBus, final DocViewerView view,
- final DocViewerProxy proxy, final Session session, final ContentViewerSelector viewerSelector,
- final ActionRegistryByType actionsRegistry, final DocsClientActions docsActions,
- final BlogsClientActions blogActions, final Provider<RenameAction> renameAction) {
- super(eventBus, view, proxy);
- this.session = session;
- this.actionsRegistry = actionsRegistry;
- this.renameAction = renameAction;
- viewerSelector.register(this, true, DocsConstants.TYPE_DOCUMENT);
- viewerSelector.register(this, true, BlogsConstants.TYPE_POST);
- session.onUserSignOut(true, new UserSignOutHandler() {
- @Override
- public void onUserSignOut(final UserSignOutEvent event) {
- getView().signOut();
- }
- });
- session.onUserSignIn(true, new UserSignInHandler() {
-
- @Override
- public void onUserSignIn(final UserSignInEvent event) {
- getView().signIn();
- }
- });
-
- }
-
- @Override
- public void attach() {
- getView().attach();
- if (editHandler == null) {
- createEditHandler();
- }
- }
-
- private void createEditHandler() {
- editHandler = getView().getEditTitle().addEditHandler(new EditHandler() {
- @Override
- public void fire(final EditEvent event) {
- renameAction.get().rename(session.getCurrentStateToken(), session.getCurrentState().getTitle(),
- event.getText(), new RenameListener() {
- @Override
- public void onFail(final StateToken token, final String oldTitle) {
- getView().setEditableTitle(oldTitle);
- }
-
- @Override
- public void onSuccess(final StateToken token, final String title) {
- getView().setEditableTitle(title);
- }
- });
- }
- });
- }
-
- @Override
- public void detach() {
- getView().detach();
- }
-
- @Override
- protected void revealInParent() {
- RevealRootContentEvent.fire(this, this);
- }
-
- @Override
- public void setContent(@Nonnull final HasContent state) {
- getView().clear();
- final StateContentDTO stateContent = (StateContentDTO) state;
- final AccessRights rights = stateContent.getContentRights();
- if (session.isLogged() && rights.isEditable()) {
- if (stateContent.isParticipant()) {
- // is already participant, show wave editor
- if (org.waveprotocol.box.webclient.client.Session.get().isLoggedIn()) {
- getView().setEditableContent(stateContent);
- } else {
- getView().setContent(stateContent);
- // When logged setEditable!
- }
- } else {
- // add "participate" action
- getView().setContent(stateContent);
- }
- } else {
- if (rights.isVisible()) {
- // Show contents
- getView().setContent(stateContent);
- } else {
- throw new UIException("Unexpected status in Viewer");
- }
- }
- final GuiActionDescCollection actions = actionsRegistry.getCurrentActions(stateContent.getGroup(),
- stateContent.getTypeId(), session.isLogged(), rights, ActionGroups.VIEW);
- 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-05-05 21:20:17 UTC (rev 1348)
+++ trunk/src/main/java/cc/kune/gspace/client/viewers/FolderViewerPresenter.java 2011-05-05 23:52:34 UTC (rev 1349)
@@ -2,7 +2,7 @@
import javax.annotation.Nonnull;
-import cc.kune.blogs.shared.BlogsConstants;
+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;
@@ -24,12 +24,11 @@
import cc.kune.core.shared.dto.HasContent;
import cc.kune.core.shared.dto.StateContainerDTO;
import cc.kune.core.shared.i18n.I18nTranslationService;
-import cc.kune.docs.shared.DocsConstants;
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;
-import cc.kune.gspace.client.tool.ContentViewerSelector;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
@@ -77,6 +76,11 @@
void showEmptyMsg();
}
+ protected static final String CSSBTN = "k-button";
+ protected static final String CSSBTNC = "k-button, k-button-center";
+ protected static final String CSSBTNL = "k-button, k-button-left";
+ protected static final String CSSBTNR = "k-button, k-button-right";
+
private final ActionRegistryByType actionsRegistry;
private final ContentCapabilitiesRegistry capabilitiesRegistry;
@@ -93,10 +97,9 @@
@Inject
public FolderViewerPresenter(final EventBus eventBus, final FolderViewerView view,
final FolderViewerProxy proxy, final Session session, final StateManager stateManager,
- final I18nTranslationService i18n, final ContentViewerSelector viewerSelector,
- final ActionRegistryByType actionsRegistry,
+ final I18nTranslationService i18n, final ActionRegistryByType actionsRegistry,
final Provider<FileDownloadUtils> downloadUtilsProvider,
- final ContentCapabilitiesRegistry capabilitiesRegistry, final Provider<RenameAction> renameAction) {
+ final Provider<RenameAction> renameAction, final ContentCapabilitiesRegistry capabilitiesRegistry) {
super(eventBus, view, proxy);
this.session = session;
this.stateManager = stateManager;
@@ -105,8 +108,6 @@
this.downloadUtilsProvider = downloadUtilsProvider;
this.capabilitiesRegistry = capabilitiesRegistry;
iconsRegistry = capabilitiesRegistry.getIconsRegistry();
- viewerSelector.register(this, true, DocsConstants.TYPE_ROOT, DocsConstants.TYPE_FOLDER);
- viewerSelector.register(this, true, BlogsConstants.TYPE_ROOT, BlogsConstants.TYPE_BLOG);
useGenericImageIcon = false;
this.renameAction = renameAction;
}
@@ -148,6 +149,19 @@
}
}
+ 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();
@@ -189,6 +203,27 @@
});
}
+ 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 = 0; i < pathLength; i++) {
+ final ButtonDescriptor btn = createPathButton(path[i], pathLength, i);
+ 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();
@@ -233,8 +268,9 @@
final AccessRights rights = stateContainer.getContainerRights();
final GuiActionDescCollection actions = actionsRegistry.getCurrentActions(stateContainer.getGroup(),
stateContainer.getTypeId(), session.isLogged(), rights, ActionGroups.VIEW);
+ final ContainerDTO container = stateContainer.getContainer();
+ createPath(container, actions);
getView().setActions(actions);
- createChildItems(stateContainer.getContainer(), stateContainer.getContainerRights());
- // view.setEditable(rights.isEditable());
+ createChildItems(container, stateContainer.getContainerRights());
}
}
\ No newline at end of file
Modified: trunk/src/test/java/cc/kune/core/server/manager/ContentManagerTest.java
===================================================================
--- trunk/src/test/java/cc/kune/core/server/manager/ContentManagerTest.java 2011-05-05 21:20:17 UTC (rev 1348)
+++ trunk/src/test/java/cc/kune/core/server/manager/ContentManagerTest.java 2011-05-05 23:52:34 UTC (rev 1349)
@@ -50,6 +50,7 @@
assertEquals(mimetype, newCnt.getMimeType().toString());
}
+ @Ignore
@Test
public void testBasicBodySearch() {
createContent();
Added: trunk/src/test/java/cc/kune/gspace/client/viewers/FolderViewerPresenterTest.java
===================================================================
--- trunk/src/test/java/cc/kune/gspace/client/viewers/FolderViewerPresenterTest.java (rev 0)
+++ trunk/src/test/java/cc/kune/gspace/client/viewers/FolderViewerPresenterTest.java 2011-05-05 23:52:34 UTC (rev 1349)
@@ -0,0 +1,50 @@
+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 org.junit.Assert.assertEquals;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mockito;
+
+import cc.kune.core.client.registry.ContentCapabilitiesRegistry;
+
+public class FolderViewerPresenterTest {
+
+ private FolderViewerPresenter presenter;
+
+ @Before
+ public void before() {
+ presenter = new FolderViewerPresenter(null, null, null, null, null, null, null, null, null,
+ Mockito.mock(ContentCapabilitiesRegistry.class));
+ }
+
+ @Test
+ public void with1() {
+ assertEquals(CSSBTN, presenter.calculateStyle(0, 1));
+ }
+
+ @Test
+ public void with2() {
+ assertEquals(CSSBTNL, presenter.calculateStyle(0, 2));
+ assertEquals(CSSBTNR, presenter.calculateStyle(1, 2));
+ }
+
+ @Test
+ public void with3() {
+ assertEquals(CSSBTNL, presenter.calculateStyle(0, 3));
+ assertEquals(CSSBTNC, presenter.calculateStyle(1, 3));
+ assertEquals(CSSBTNR, presenter.calculateStyle(2, 3));
+ }
+
+ @Test
+ public void with4() {
+ assertEquals(CSSBTNL, presenter.calculateStyle(0, 4));
+ assertEquals(CSSBTNC, presenter.calculateStyle(1, 4));
+ assertEquals(CSSBTNC, presenter.calculateStyle(2, 4));
+ assertEquals(CSSBTNR, presenter.calculateStyle(3, 4));
+ }
+}
Property changes on: trunk/src/test/java/cc/kune/gspace/client/viewers/FolderViewerPresenterTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
More information about the kune-commits
mailing list