[kune-commits] r1719 - in trunk/src/main/java/cc/kune: barters/client blogs/client common/client/actions/ui/descrip core/client/dnd core/client/rpcservices core/client/sn core/client/ui core/server/content core/server/rpc docs/client events/client/viewer gspace/client gspace/client/actions gspace/client/tool/selector gspace/client/viewers gspace/client/viewers/items tasks/client wave/server/kspecific wiki/client
Vicente J. Ruiz Jurado
vjrj_ at ourproject.org
Tue Feb 28 19:56:20 CET 2012
Author: vjrj_
Date: 2012-02-28 19:56:19 +0100 (Tue, 28 Feb 2012)
New Revision: 1719
Added:
trunk/src/main/java/cc/kune/core/client/dnd/AbstractDropController.java
trunk/src/main/java/cc/kune/core/client/dnd/FolderContainerDropController.java
trunk/src/main/java/cc/kune/core/client/dnd/FolderContentDropController.java
trunk/src/main/java/cc/kune/gspace/client/viewers/ContentDropController.java
Removed:
trunk/src/main/java/cc/kune/core/client/dnd/FolderViewerDropController.java
Modified:
trunk/src/main/java/cc/kune/barters/client/BartersClientTool.java
trunk/src/main/java/cc/kune/blogs/client/BlogsClientTool.java
trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/DropTarget.java
trunk/src/main/java/cc/kune/core/client/rpcservices/ContentService.java
trunk/src/main/java/cc/kune/core/client/rpcservices/ContentServiceAsync.java
trunk/src/main/java/cc/kune/core/client/sn/AbstractSNPanel.java
trunk/src/main/java/cc/kune/core/client/sn/GroupSNPanel.java
trunk/src/main/java/cc/kune/core/client/sn/UserSNPanel.java
trunk/src/main/java/cc/kune/core/client/ui/BasicDragableThumb.java
trunk/src/main/java/cc/kune/core/server/content/ContentManager.java
trunk/src/main/java/cc/kune/core/server/content/ContentManagerDefault.java
trunk/src/main/java/cc/kune/core/server/rpc/ContentRPC.java
trunk/src/main/java/cc/kune/docs/client/DocsClientTool.java
trunk/src/main/java/cc/kune/events/client/viewer/CalendarViewerPanel.java
trunk/src/main/java/cc/kune/gspace/client/GSpaceGinModule.java
trunk/src/main/java/cc/kune/gspace/client/actions/ParticipateInContentBtn.java
trunk/src/main/java/cc/kune/gspace/client/tool/selector/ToolSelectorPanel.java
trunk/src/main/java/cc/kune/gspace/client/viewers/AbstractFolderViewerPanel.java
trunk/src/main/java/cc/kune/gspace/client/viewers/ContentViewerPanel.java
trunk/src/main/java/cc/kune/gspace/client/viewers/FolderViewerAsFlowPanel.java
trunk/src/main/java/cc/kune/gspace/client/viewers/FolderViewerAsTablePanel.java
trunk/src/main/java/cc/kune/gspace/client/viewers/FolderViewerUtils.java
trunk/src/main/java/cc/kune/gspace/client/viewers/PathToolbarUtils.java
trunk/src/main/java/cc/kune/gspace/client/viewers/items/FolderItemDescriptor.java
trunk/src/main/java/cc/kune/tasks/client/TasksClientTool.java
trunk/src/main/java/cc/kune/wave/server/kspecific/KuneAgent.java
trunk/src/main/java/cc/kune/wave/server/kspecific/KuneWaveService.java
trunk/src/main/java/cc/kune/wave/server/kspecific/KuneWaveServiceDefault.java
trunk/src/main/java/cc/kune/wiki/client/WikiClientTool.java
Log:
NEW - # 198: Add Drag and Drop from users to contents and vice versa
http://kune.ourproject.org/issues/ticket/198
Modified: trunk/src/main/java/cc/kune/barters/client/BartersClientTool.java
===================================================================
--- trunk/src/main/java/cc/kune/barters/client/BartersClientTool.java 2012-02-28 02:09:40 UTC (rev 1718)
+++ trunk/src/main/java/cc/kune/barters/client/BartersClientTool.java 2012-02-28 18:56:19 UTC (rev 1719)
@@ -67,7 +67,7 @@
private void registerIcons() {
registerTutorial(TYPE_ROOT);
- registerTutorial(TYPE_FOLDER);
+ // registerTutorial(TYPE_FOLDER);
registerContentTypeIcon(TYPE_FOLDER, navResources.folder());
registerContentTypeIcon(TYPE_ROOT, icons.barters());
registerContentTypeIcon(TYPE_BARTER, navResources.barter());
Modified: trunk/src/main/java/cc/kune/blogs/client/BlogsClientTool.java
===================================================================
--- trunk/src/main/java/cc/kune/blogs/client/BlogsClientTool.java 2012-02-28 02:09:40 UTC (rev 1718)
+++ trunk/src/main/java/cc/kune/blogs/client/BlogsClientTool.java 2012-02-28 18:56:19 UTC (rev 1719)
@@ -68,7 +68,7 @@
private void registerIcons() {
registerTutorial(TYPE_ROOT);
- registerTutorial(TYPE_BLOG);
+ // registerTutorial(TYPE_BLOG);
registerContentTypeIcon(TYPE_ROOT, icons.blogs());
registerContentTypeIcon(TYPE_BLOG, navResources.blog());
registerContentTypeIcon(TYPE_POST, navResources.post());
Modified: trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/DropTarget.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/DropTarget.java 2012-02-28 02:09:40 UTC (rev 1718)
+++ trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/DropTarget.java 2012-02-28 18:56:19 UTC (rev 1719)
@@ -21,8 +21,17 @@
import com.google.gwt.user.client.ui.Widget;
+/**
+ * The Interface DropTarget is used to allow drop to this widget
+ */
public interface DropTarget {
+ /**
+ * Initialize the drop target widget
+ *
+ * @param dropTarget
+ * the drop target
+ */
void init(Widget dropTarget);
}
Added: trunk/src/main/java/cc/kune/core/client/dnd/AbstractDropController.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/dnd/AbstractDropController.java (rev 0)
+++ trunk/src/main/java/cc/kune/core/client/dnd/AbstractDropController.java 2012-02-28 18:56:19 UTC (rev 1719)
@@ -0,0 +1,218 @@
+/*
+ *
+ * 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.core.client.dnd;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import cc.kune.common.client.actions.ui.descrip.DropTarget;
+
+import com.allen_sauer.gwt.dnd.client.DragContext;
+import com.allen_sauer.gwt.dnd.client.VetoDragException;
+import com.allen_sauer.gwt.dnd.client.drop.SimpleDropController;
+import com.google.gwt.event.logical.shared.AttachEvent;
+import com.google.gwt.event.logical.shared.AttachEvent.Handler;
+import com.google.gwt.user.client.ui.Widget;
+
+/**
+ * The Class AbstractDropController.
+ */
+public abstract class AbstractDropController implements DropTarget {
+
+ /** The accepted types (which one we allow to drop here). */
+ private final List<Class<?>> acceptedTypes;
+
+ private final KuneDragController dragController;
+
+ private SimpleDropController dropController;
+
+ /** The target. */
+ private Object target;
+
+ /**
+ * Instantiates a new abstract drop controller.
+ *
+ * @param dragController
+ * the drag controller
+ */
+ public AbstractDropController(final KuneDragController dragController) {
+ this.dragController = dragController;
+ acceptedTypes = new ArrayList<Class<?>>();
+ }
+
+ /**
+ * Gets the target.
+ *
+ * @return the target
+ */
+ public Object getTarget() {
+ return target;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * cc.kune.common.client.actions.ui.descrip.DropTarget#init(com.google.gwt
+ * .user.client.ui.Widget)
+ */
+ @Override
+ public void init(final Widget dropTarget) {
+ dropController = new SimpleDropController(dropTarget) {
+
+ @Override
+ public void onDrop(final DragContext context) {
+ boolean droppedSomething = false;
+ super.onDrop(context);
+ for (final Widget widget : context.selectedWidgets) {
+ if (acceptedTypes.contains(widget.getClass())) {
+ onDropAllowed(widget, this);
+ droppedSomething = true;
+ }
+ }
+ if (droppedSomething) {
+ onGroupDropFinished(this);
+ }
+ }
+
+ @Override
+ public void onEnter(final DragContext context) {
+ super.onEnter(context);
+ for (final Widget widget : context.selectedWidgets) {
+ if (acceptedTypes.contains(widget.getClass())) {
+ onEnterAllowed(this);
+ }
+ }
+ }
+
+ @Override
+ public void onLeave(final DragContext context) {
+ super.onLeave(context);
+ for (final Widget widget : context.selectedWidgets) {
+ if (acceptedTypes.contains(widget.getClass())) {
+ onLeaveAllowed(this);
+ }
+ }
+ }
+
+ @Override
+ public void onPreviewDrop(final DragContext context) throws VetoDragException {
+ for (final Widget widget : context.selectedWidgets) {
+ if (acceptedTypes.contains(widget.getClass())) {
+ onPreviewAllowed(this);
+ } else {
+ throw new VetoDragException();
+ }
+ }
+ super.onPreviewDrop(context);
+ }
+ };
+
+ dropTarget.addStyleName("k-drop-allowed");
+
+ if (dropTarget.isAttached()) {
+ dragController.registerDropController(dropController);
+ }
+
+ dropTarget.addAttachHandler(new Handler() {
+ @Override
+ public void onAttachOrDetach(final AttachEvent event) {
+ if (!event.isAttached()) {
+ dragController.unregisterDropController(dropController);
+ } else {
+ dragController.registerDropController(dropController);
+ }
+ }
+ });
+ }
+
+ /**
+ * On drop allowed.
+ *
+ * @param widget
+ * the widget
+ * @param dropController
+ * the drop controller
+ */
+ public abstract void onDropAllowed(Widget widget, final SimpleDropController dropController);
+
+ /**
+ * On enter allowed.
+ *
+ * @param dropController
+ * the drop controller
+ */
+ public void onEnterAllowed(final SimpleDropController dropController) {
+ dropController.getDropTarget().addStyleName("k-drop-allowed-hover");
+ }
+
+ /**
+ * On group drop finished, is fired when all the widgets are dropped (at the
+ * end)
+ *
+ * @param dropController
+ * the drop controller
+ */
+ public void onGroupDropFinished(final SimpleDropController dropController) {
+
+ }
+
+ /**
+ * On leave allowed.
+ *
+ * @param dropController
+ * the drop controller
+ */
+ public void onLeaveAllowed(final SimpleDropController dropController) {
+ dropController.getDropTarget().removeStyleName("k-drop-allowed-hover");
+ }
+
+ /**
+ * On preview allowed.
+ *
+ * @param dropController
+ * the drop controller
+ */
+ public void onPreviewAllowed(final SimpleDropController dropController) {
+ dropController.getDropTarget().removeStyleName("k-drop-allowed-hover");
+ }
+
+ /**
+ * Register type to accept this kind of widgets to be dropped here
+ *
+ * @param classType
+ * the class type
+ */
+ public void registerType(final Class<?> classType) {
+ acceptedTypes.add(classType);
+ }
+
+ /**
+ * Sets the target (for instance a StateToken id, to perform operations),
+ * because with the widget we don't have all the info
+ *
+ * @param target
+ * the new target
+ */
+ public void setTarget(final Object target) {
+ this.target = target;
+ }
+
+}
Copied: trunk/src/main/java/cc/kune/core/client/dnd/FolderContainerDropController.java (from rev 1717, trunk/src/main/java/cc/kune/core/client/dnd/FolderViewerDropController.java)
===================================================================
--- trunk/src/main/java/cc/kune/core/client/dnd/FolderContainerDropController.java (rev 0)
+++ trunk/src/main/java/cc/kune/core/client/dnd/FolderContainerDropController.java 2012-02-28 18:56:19 UTC (rev 1719)
@@ -0,0 +1,94 @@
+/*
+ *
+ * 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.core.client.dnd;
+
+import cc.kune.common.client.notify.NotifyUser;
+import cc.kune.common.shared.i18n.I18nTranslationService;
+import cc.kune.common.shared.utils.TextUtils;
+import cc.kune.core.client.errors.ErrorHandler;
+import cc.kune.core.client.rpcservices.ContentServiceAsync;
+import cc.kune.core.client.state.ContentCache;
+import cc.kune.core.client.state.Session;
+import cc.kune.core.client.state.StateManager;
+import cc.kune.core.shared.domain.utils.StateToken;
+import cc.kune.core.shared.dto.StateContainerDTO;
+import cc.kune.gspace.client.viewers.items.FolderItemWidget;
+
+import com.allen_sauer.gwt.dnd.client.drop.SimpleDropController;
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.google.gwt.user.client.ui.Widget;
+import com.google.inject.Inject;
+
+public class FolderContainerDropController extends AbstractDropController {
+
+ private final ContentCache contentCache;
+ private final ContentServiceAsync contentService;
+ private final ErrorHandler erroHandler;
+ private final I18nTranslationService i18n;
+ private final Session session;
+ private final StateManager stateManager;
+
+ @Inject
+ public FolderContainerDropController(final KuneDragController dragController,
+ final ContentServiceAsync contentService, final Session session, final StateManager stateManager,
+ final ErrorHandler erroHandler, final I18nTranslationService i18n, final ContentCache contentCache) {
+ super(dragController);
+ registerType(FolderItemWidget.class);
+ this.contentService = contentService;
+ this.session = session;
+ this.stateManager = stateManager;
+ this.erroHandler = erroHandler;
+ this.i18n = i18n;
+ this.contentCache = contentCache;
+ }
+
+ @Override
+ public void onDropAllowed(final Widget widget, final SimpleDropController dropController) {
+ dropController.getDropTarget().removeStyleName("k-drop-allowed-hover");
+ if (widget instanceof FolderItemWidget) {
+ NotifyUser.showProgress(i18n.t("Moving"));
+ if (getTarget() != null) {
+ final StateToken destToken = (StateToken) getTarget();
+ widget.removeFromParent();
+ final StateToken tokenToMove = ((FolderItemWidget) widget).getToken();
+ contentService.moveContent(session.getUserHash(), tokenToMove, destToken,
+ new AsyncCallback<StateContainerDTO>() {
+ @Override
+ public void onFailure(final Throwable caught) {
+ erroHandler.process(caught);
+ stateManager.refreshCurrentState();
+ NotifyUser.hideProgress();
+ }
+
+ @Override
+ public void onSuccess(final StateContainerDTO result) {
+ NotifyUser.hideProgress();
+ contentCache.remove(tokenToMove);
+ contentCache.remove(destToken);
+ }
+ });
+ } else {
+ NotifyUser.info(i18n.t(TextUtils.IN_DEVELOPMENT));
+ NotifyUser.hideProgress();
+ }
+ }
+ }
+
+}
Added: trunk/src/main/java/cc/kune/core/client/dnd/FolderContentDropController.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/dnd/FolderContentDropController.java (rev 0)
+++ trunk/src/main/java/cc/kune/core/client/dnd/FolderContentDropController.java 2012-02-28 18:56:19 UTC (rev 1719)
@@ -0,0 +1,70 @@
+/*
+ *
+ * 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.core.client.dnd;
+
+import cc.kune.common.client.notify.NotifyUser;
+import cc.kune.common.shared.i18n.I18nTranslationService;
+import cc.kune.core.client.rpcservices.AsyncCallbackSimple;
+import cc.kune.core.client.rpcservices.ContentServiceAsync;
+import cc.kune.core.client.state.Session;
+import cc.kune.core.client.ui.BasicDragableThumb;
+import cc.kune.core.shared.domain.utils.StateToken;
+
+import com.allen_sauer.gwt.dnd.client.drop.SimpleDropController;
+import com.google.gwt.user.client.ui.Widget;
+import com.google.inject.Inject;
+
+public class FolderContentDropController extends AbstractDropController {
+
+ private final ContentServiceAsync contentService;
+ private final I18nTranslationService i18n;
+ private final Session session;
+
+ @Inject
+ public FolderContentDropController(final KuneDragController dragController,
+ final ContentServiceAsync contentService, final Session session, final I18nTranslationService i18n) {
+ super(dragController);
+ this.i18n = i18n;
+ registerType(BasicDragableThumb.class);
+ this.contentService = contentService;
+ this.session = session;
+ }
+
+ @Override
+ public void onDropAllowed(final Widget widget, final SimpleDropController dropController) {
+ dropController.getDropTarget().removeStyleName("k-drop-allowed-hover");
+ if (widget instanceof BasicDragableThumb) {
+ final BasicDragableThumb thumb = (BasicDragableThumb) widget;
+ final String userName = thumb.getToken().getGroup();
+ contentService.addParticipant(session.getUserHash(), (StateToken) getTarget(), userName,
+ new AsyncCallbackSimple<Boolean>() {
+ @Override
+ public void onSuccess(final Boolean result) {
+ if (result) {
+ NotifyUser.info(i18n.t("User '[%s]' added as participant", userName));
+ } else {
+ NotifyUser.info(i18n.t("This user is already partipanting"));
+ }
+ }
+ });
+ }
+ }
+
+}
Deleted: trunk/src/main/java/cc/kune/core/client/dnd/FolderViewerDropController.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/dnd/FolderViewerDropController.java 2012-02-28 02:09:40 UTC (rev 1718)
+++ trunk/src/main/java/cc/kune/core/client/dnd/FolderViewerDropController.java 2012-02-28 18:56:19 UTC (rev 1719)
@@ -1,161 +0,0 @@
-/*
- *
- * Copyright (C) 2007-2011 The kune development team (see CREDITS for details)
- * This file is part of kune.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-package cc.kune.core.client.dnd;
-
-import cc.kune.common.client.actions.ui.descrip.DropTarget;
-import cc.kune.common.client.notify.NotifyUser;
-import cc.kune.common.shared.i18n.I18nTranslationService;
-import cc.kune.common.shared.utils.TextUtils;
-import cc.kune.core.client.errors.ErrorHandler;
-import cc.kune.core.client.rpcservices.ContentServiceAsync;
-import cc.kune.core.client.state.ContentCache;
-import cc.kune.core.client.state.Session;
-import cc.kune.core.client.state.StateManager;
-import cc.kune.core.shared.domain.utils.StateToken;
-import cc.kune.core.shared.dto.StateContainerDTO;
-import cc.kune.gspace.client.viewers.items.FolderItemWidget;
-
-import com.allen_sauer.gwt.dnd.client.DragContext;
-import com.allen_sauer.gwt.dnd.client.VetoDragException;
-import com.allen_sauer.gwt.dnd.client.drop.SimpleDropController;
-import com.google.gwt.event.logical.shared.AttachEvent;
-import com.google.gwt.event.logical.shared.AttachEvent.Handler;
-import com.google.gwt.user.client.rpc.AsyncCallback;
-import com.google.gwt.user.client.ui.Widget;
-import com.google.inject.Inject;
-
-public class FolderViewerDropController implements DropTarget {
-
- private final ContentCache contentCache;
- private final ContentServiceAsync contentService;
- private final KuneDragController dragController;
- private SimpleDropController dropController;
- private final ErrorHandler erroHandler;
- private final I18nTranslationService i18n;
- private final Session session;
- private final StateManager stateManager;
- private Object target;
-
- @Inject
- public FolderViewerDropController(final KuneDragController dragController,
- final ContentServiceAsync contentService, final Session session, final StateManager stateManager,
- final ErrorHandler erroHandler, final I18nTranslationService i18n, final ContentCache contentCache) {
- this.dragController = dragController;
- this.contentService = contentService;
- this.session = session;
- this.stateManager = stateManager;
- this.erroHandler = erroHandler;
- this.i18n = i18n;
- this.contentCache = contentCache;
- }
-
- @Override
- public void init(final Widget dropTarget) {
- dropController = new SimpleDropController(dropTarget) {
-
- @Override
- public void onDrop(final DragContext context) {
- super.onDrop(context);
- for (final Widget widget : context.selectedWidgets) {
- if (widget instanceof FolderItemWidget) {
- getDropTarget().removeStyleName("k-drop-allowed-hover");
- NotifyUser.showProgress(i18n.t("Moving"));
- if (target != null) {
- final StateToken destToken = (StateToken) target;
- widget.removeFromParent();
- final StateToken tokenToMove = ((FolderItemWidget) widget).getToken();
- contentService.moveContent(session.getUserHash(), tokenToMove, destToken,
- new AsyncCallback<StateContainerDTO>() {
- @Override
- public void onFailure(final Throwable caught) {
- erroHandler.process(caught);
- stateManager.refreshCurrentState();
- NotifyUser.hideProgress();
- }
-
- @Override
- public void onSuccess(final StateContainerDTO result) {
- NotifyUser.hideProgress();
- contentCache.remove(tokenToMove);
- contentCache.remove(destToken);
- }
- });
- } else {
- NotifyUser.info(i18n.t(TextUtils.IN_DEVELOPMENT));
- NotifyUser.hideProgress();
- }
- }
- }
- }
-
- @Override
- public void onEnter(final DragContext context) {
- super.onEnter(context);
- for (final Widget widget : context.selectedWidgets) {
- if (widget instanceof FolderItemWidget) {
- getDropTarget().addStyleName("k-drop-allowed-hover");
- }
- }
- }
-
- @Override
- public void onLeave(final DragContext context) {
- super.onLeave(context);
- for (final Widget widget : context.selectedWidgets) {
- if (widget instanceof FolderItemWidget) {
- getDropTarget().removeStyleName("k-drop-allowed-hover");
- }
- }
- }
-
- @Override
- public void onPreviewDrop(final DragContext context) throws VetoDragException {
- for (final Widget widget : context.selectedWidgets) {
- if (widget instanceof FolderItemWidget) {
- getDropTarget().removeStyleName("k-drop-allowed-hover");
- } else {
- throw new VetoDragException();
- }
- }
- super.onPreviewDrop(context);
- }
- };
-
- dropTarget.addStyleName("k-drop-allowed");
- if (dropTarget.isAttached()) {
- dragController.registerDropController(dropController);
- }
- dropTarget.addAttachHandler(new Handler() {
- @Override
- public void onAttachOrDetach(final AttachEvent event) {
- if (!event.isAttached()) {
- dragController.unregisterDropController(dropController);
- } else {
- dragController.registerDropController(dropController);
- }
- }
- });
- }
-
- public void setTarget(final Object target) {
- this.target = target;
- }
-
-}
Modified: trunk/src/main/java/cc/kune/core/client/rpcservices/ContentService.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/rpcservices/ContentService.java 2012-02-28 02:09:40 UTC (rev 1718)
+++ trunk/src/main/java/cc/kune/core/client/rpcservices/ContentService.java 2012-02-28 18:56:19 UTC (rev 1719)
@@ -57,7 +57,7 @@
String gadgetName, String typeId, String tile, String body, Map<String, String> gadgetState)
throws DefaultException;;
- void addParticipant(String userHash, StateToken token, String participant) throws DefaultException;
+ Boolean addParticipant(String userHash, StateToken token, String participant) throws DefaultException;
StateContainerDTO addRoom(String user, StateToken parentToken, String name) throws DefaultException;
Modified: trunk/src/main/java/cc/kune/core/client/rpcservices/ContentServiceAsync.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/rpcservices/ContentServiceAsync.java 2012-02-28 02:09:40 UTC (rev 1718)
+++ trunk/src/main/java/cc/kune/core/client/rpcservices/ContentServiceAsync.java 2012-02-28 18:56:19 UTC (rev 1719)
@@ -22,7 +22,6 @@
import java.util.Date;
import java.util.Map;
-import cc.kune.core.client.errors.DefaultException;
import cc.kune.core.shared.domain.ContentStatus;
import cc.kune.core.shared.domain.RateResult;
import cc.kune.core.shared.domain.TagCloudResult;
@@ -56,8 +55,8 @@
String typeId, String title, String body, Map<String, String> gadgetState,
AsyncCallback<StateContentDTO> callback);
- void addParticipant(String userHash, StateToken token, String authorShortName,
- AsyncCallback<Void> asyncCallback) throws DefaultException;
+ void addParticipant(String userHash, StateToken token, String participant,
+ AsyncCallback<Boolean> asyncCallback);
void addRoom(String user, StateToken parentToken, String name,
AsyncCallback<StateContainerDTO> callback);
Modified: trunk/src/main/java/cc/kune/core/client/sn/AbstractSNPanel.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sn/AbstractSNPanel.java 2012-02-28 02:09:40 UTC (rev 1718)
+++ trunk/src/main/java/cc/kune/core/client/sn/AbstractSNPanel.java 2012-02-28 18:56:19 UTC (rev 1719)
@@ -33,6 +33,7 @@
import cc.kune.core.client.dnd.KuneDragController;
import cc.kune.core.client.dnd.NotImplementedDropManager;
import cc.kune.core.client.ui.BasicDragableThumb;
+import cc.kune.core.shared.domain.utils.StateToken;
import cc.kune.gspace.client.armor.GSpaceArmor;
import com.google.gwt.core.client.GWT;
@@ -134,9 +135,9 @@
}
public BasicDragableThumb createThumb(final String text, final String avatarUrl, final String tooltip,
- final String tooltipTitle, final GuiActionDescCollection menuitems) {
+ final String tooltipTitle, final GuiActionDescCollection menuitems, final StateToken token) {
final BasicDragableThumb thumb = new BasicDragableThumb(avatarUrl, AVATARSIZE, text,
- AVATARLABELMAXSIZE, false);
+ AVATARLABELMAXSIZE, false, token);
final ClickHandler clickHand = new ClickHandler() {
MenuDescriptor menu;
Modified: trunk/src/main/java/cc/kune/core/client/sn/GroupSNPanel.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sn/GroupSNPanel.java 2012-02-28 02:09:40 UTC (rev 1718)
+++ trunk/src/main/java/cc/kune/core/client/sn/GroupSNPanel.java 2012-02-28 18:56:19 UTC (rev 1719)
@@ -66,7 +66,7 @@
public void addAdmin(final GroupDTO group, final String avatarUrl, final String tooltip,
final String tooltipTitle, final GuiActionDescCollection menu) {
final BasicDragableThumb thumb = createThumb(group.getCompoundName(), avatarUrl, tooltip,
- tooltipTitle, menu);
+ tooltipTitle, menu, group.getStateToken());
firstCategoryFlow.add(group.isPersonal() ? (Widget) decorateAvatarWithXmppStatus(
group.getShortName(), thumb) : thumb);
}
@@ -75,7 +75,7 @@
public void addCollab(final GroupDTO group, final String avatarUrl, final String tooltip,
final String tooltipTitle, final GuiActionDescCollection menu) {
final BasicDragableThumb thumb = createThumb(group.getCompoundName(), avatarUrl, tooltip,
- tooltipTitle, menu);
+ tooltipTitle, menu, group.getStateToken());
sndCategoryFlow.add(group.isPersonal() ? (Widget) decorateAvatarWithXmppStatus(group.getShortName(),
thumb) : thumb);
}
@@ -84,7 +84,7 @@
public void addPending(final GroupDTO group, final String avatarUrl, final String tooltip,
final String tooltipTitle, final GuiActionDescCollection menu) {
final BasicDragableThumb thumb = createThumb(group.getCompoundName(), avatarUrl, tooltip,
- tooltipTitle, menu);
+ tooltipTitle, menu, group.getStateToken());
trdCategoryFlow.add(thumb);
}
Modified: trunk/src/main/java/cc/kune/core/client/sn/UserSNPanel.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sn/UserSNPanel.java 2012-02-28 02:09:40 UTC (rev 1718)
+++ trunk/src/main/java/cc/kune/core/client/sn/UserSNPanel.java 2012-02-28 18:56:19 UTC (rev 1719)
@@ -77,14 +77,15 @@
public void addBuddie(final UserSimpleDTO user, final String avatarUrl, final String tooltip,
final String tooltipTitle, final GuiActionDescCollection menu) {
final BasicDragableThumb thumb = createThumb(user.getShortName(), avatarUrl, tooltip, tooltipTitle,
- menu);
+ menu, user.getStateToken());
firstCategoryFlow.add((Widget) decorateAvatarWithXmppStatus(user.getShortName(), thumb));
}
@Override
public void addParticipation(final GroupDTO group, final String avatarUrl, final String tooltip,
final String tooltipTitle, final GuiActionDescCollection menu) {
- sndCategoryFlow.add(createThumb(group.getCompoundName(), avatarUrl, tooltip, tooltipTitle, menu));
+ sndCategoryFlow.add(createThumb(group.getCompoundName(), avatarUrl, tooltip, tooltipTitle, menu,
+ group.getStateToken()));
}
@Override
Modified: trunk/src/main/java/cc/kune/core/client/ui/BasicDragableThumb.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/ui/BasicDragableThumb.java 2012-02-28 02:09:40 UTC (rev 1718)
+++ trunk/src/main/java/cc/kune/core/client/ui/BasicDragableThumb.java 2012-02-28 18:56:19 UTC (rev 1719)
@@ -1,15 +1,19 @@
package cc.kune.core.client.ui;
import cc.kune.common.client.ui.BasicThumb;
+import cc.kune.core.shared.domain.utils.StateToken;
import com.allen_sauer.gwt.dnd.client.HasDragHandle;
import com.google.gwt.user.client.ui.Widget;
public class BasicDragableThumb extends BasicThumb implements HasDragHandle {
+ private final StateToken token;
+
public BasicDragableThumb(final Object imageRef, final int imgSize, final String text,
- final int textMaxLenght, final boolean crop) {
+ final int textMaxLenght, final boolean crop, final StateToken token) {
super(imageRef, imgSize, text, textMaxLenght, crop);
+ this.token = token;
}
@Override
@@ -17,4 +21,8 @@
return getImage();
}
+ public StateToken getToken() {
+ return token;
+ }
+
}
Modified: trunk/src/main/java/cc/kune/core/server/content/ContentManager.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/content/ContentManager.java 2012-02-28 02:09:40 UTC (rev 1718)
+++ trunk/src/main/java/cc/kune/core/server/content/ContentManager.java 2012-02-28 18:56:19 UTC (rev 1719)
@@ -49,7 +49,7 @@
void addGadgetToContent(User user, Content content, String gadgetName);
- void addParticipant(User user, Long contentId, String participant);
+ boolean addParticipant(User user, Long contentId, String participant);
Content createGadget(User user, Container container, String gadgetname, String typeIdChild,
String title, String body, Map<String, String> gadgetProperties);
Modified: trunk/src/main/java/cc/kune/core/server/content/ContentManagerDefault.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/content/ContentManagerDefault.java 2012-02-28 02:09:40 UTC (rev 1718)
+++ trunk/src/main/java/cc/kune/core/server/content/ContentManagerDefault.java 2012-02-28 18:56:19 UTC (rev 1719)
@@ -130,12 +130,13 @@
}
@Override
- public void addParticipant(final User user, final Long contentId, final String participant) {
+ public boolean addParticipant(final User user, final Long contentId, final String participant) {
final Content content = finder.getContent(contentId);
if (content.isWave()) {
- kuneWaveManager.addParticipants(KuneWaveServerUtils.getWaveRef(content),
+ return kuneWaveManager.addParticipants(KuneWaveServerUtils.getWaveRef(content),
getContentAuthor(content), user.getShortName(), participant);
}
+ return false;
}
protected Content createContent(final String title, final String body, final User author,
Modified: trunk/src/main/java/cc/kune/core/server/rpc/ContentRPC.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/rpc/ContentRPC.java 2012-02-28 02:09:40 UTC (rev 1718)
+++ trunk/src/main/java/cc/kune/core/server/rpc/ContentRPC.java 2012-02-28 18:56:19 UTC (rev 1719)
@@ -185,11 +185,11 @@
@Authenticated
@Authorizated(accessRolRequired = AccessRol.Editor, mustCheckMembership = false)
@Transactional
- public void addParticipant(final String userHash, final StateToken token, final String participant)
+ public Boolean addParticipant(final String userHash, final StateToken token, final String participant)
throws DefaultException {
final Long contentId = ContentUtils.parseId(token.getDocument());
final User user = getCurrentUser();
- contentManager.addParticipant(user, contentId, participant);
+ return contentManager.addParticipant(user, contentId, participant);
}
@Override
Modified: trunk/src/main/java/cc/kune/docs/client/DocsClientTool.java
===================================================================
--- trunk/src/main/java/cc/kune/docs/client/DocsClientTool.java 2012-02-28 02:09:40 UTC (rev 1718)
+++ trunk/src/main/java/cc/kune/docs/client/DocsClientTool.java 2012-02-28 18:56:19 UTC (rev 1719)
@@ -53,7 +53,7 @@
// registerAclEditableTypes(TYPE_DOCUMENT, TYPE_UPLOADEDFILE);
registerAuthorableTypes(TYPE_DOCUMENT, TYPE_UPLOADEDFILE);
registerDragableTypes(TYPE_DOCUMENT, TYPE_FOLDER, TYPE_UPLOADEDFILE);
- registerDropableTypes(TYPE_ROOT, TYPE_FOLDER);
+ registerDropableTypes(TYPE_ROOT, TYPE_FOLDER, TYPE_DOCUMENT);
registerPublishModerableTypes(TYPE_DOCUMENT, TYPE_UPLOADEDFILE);
registerRateableTypes(TYPE_DOCUMENT, TYPE_UPLOADEDFILE);
registerRenamableTypes(TYPE_DOCUMENT, TYPE_FOLDER, TYPE_UPLOADEDFILE);
@@ -69,7 +69,7 @@
private void registerIcons() {
registerTutorial(TYPE_ROOT);
- registerTutorial(TYPE_FOLDER);
+ // registerTutorial(TYPE_FOLDER);
registerContentTypeIcon(TYPE_FOLDER, navResources.folder());
registerContentTypeIcon(TYPE_ROOT, icons.docs());
registerContentTypeIcon(TYPE_DOCUMENT, navResources.page());
Modified: trunk/src/main/java/cc/kune/events/client/viewer/CalendarViewerPanel.java
===================================================================
--- trunk/src/main/java/cc/kune/events/client/viewer/CalendarViewerPanel.java 2012-02-28 02:09:40 UTC (rev 1718)
+++ trunk/src/main/java/cc/kune/events/client/viewer/CalendarViewerPanel.java 2012-02-28 18:56:19 UTC (rev 1719)
@@ -6,7 +6,8 @@
import cc.kune.common.client.actions.ui.GuiProvider;
import cc.kune.common.client.ui.UiUtils;
import cc.kune.common.shared.i18n.I18nTranslationService;
-import cc.kune.core.client.dnd.FolderViewerDropController;
+import cc.kune.core.client.dnd.FolderContainerDropController;
+import cc.kune.core.client.dnd.FolderContentDropController;
import cc.kune.core.client.dnd.KuneDragController;
import cc.kune.core.client.registry.ContentCapabilitiesRegistry;
import cc.kune.core.client.resources.CoreResources;
@@ -56,9 +57,11 @@
public CalendarViewerPanel(final GSpaceArmor gsArmor, final EventBus eventBus,
final I18nTranslationService i18n, final GuiProvider guiProvider, final CoreResources res,
final ContentCapabilitiesRegistry capabilitiesRegistry, final KuneDragController dragController,
- final Provider<FolderViewerDropController> dropControllerProv, final TutorialViewer tutorialViewer) {
- super(gsArmor, eventBus, i18n, capabilitiesRegistry, dragController, dropControllerProv,
- tutorialViewer);
+ final Provider<FolderContentDropController> contentDropControllerProv,
+ final Provider<FolderContainerDropController> containerDropControllerProv,
+ final TutorialViewer tutorialViewer) {
+ super(gsArmor, eventBus, i18n, capabilitiesRegistry, dragController, contentDropControllerProv,
+ containerDropControllerProv, tutorialViewer);
final CalendarSettings settings = new CalendarSettings();
settings.setIntervalsPerHour(4);
settings.setPixelsPerInterval(10);
Modified: trunk/src/main/java/cc/kune/gspace/client/GSpaceGinModule.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/GSpaceGinModule.java 2012-02-28 02:09:40 UTC (rev 1718)
+++ trunk/src/main/java/cc/kune/gspace/client/GSpaceGinModule.java 2012-02-28 18:56:19 UTC (rev 1719)
@@ -20,6 +20,8 @@
package cc.kune.gspace.client;
import cc.kune.core.client.ExtendedGinModule;
+import cc.kune.core.client.dnd.FolderContainerDropController;
+import cc.kune.core.client.dnd.FolderContentDropController;
import cc.kune.core.client.sitebar.search.SitebarSearchPanel;
import cc.kune.core.client.sitebar.search.SitebarSearchPresenter;
import cc.kune.core.client.sn.actions.WriteToBuddyHeaderButton;
@@ -112,6 +114,7 @@
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.ContentDropController;
import cc.kune.gspace.client.viewers.ContentViewerPanel;
import cc.kune.gspace.client.viewers.ContentViewerPresenter;
import cc.kune.gspace.client.viewers.FolderViewerAsTablePanel;
@@ -134,6 +137,9 @@
protected void configure() {
s(PathToolbarUtils.class);
s(FolderViewerUtils.class);
+ s(ContentDropController.class);
+ s(FolderContainerDropController.class);
+ s(FolderContentDropController.class);
bindPresenter(EntityLicensePresenter.class, EntityLicensePresenter.EntityLicenseView.class,
EntityLicensePanel.class, EntityLicensePresenter.EntityLicenseProxy.class);
bindPresenter(TagsSummaryPresenter.class, TagsSummaryPresenter.TagsSummaryView.class,
Modified: trunk/src/main/java/cc/kune/gspace/client/actions/ParticipateInContentBtn.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/actions/ParticipateInContentBtn.java 2012-02-28 02:09:40 UTC (rev 1718)
+++ trunk/src/main/java/cc/kune/gspace/client/actions/ParticipateInContentBtn.java 2012-02-28 18:56:19 UTC (rev 1719)
@@ -58,9 +58,9 @@
public void actionPerformed(final ActionEvent event) {
NotifyUser.showProgress();
contentService.get().addParticipant(session.getUserHash(), session.getCurrentStateToken(),
- session.getCurrentUser().getShortName(), new AsyncCallbackSimple<Void>() {
+ session.getCurrentUser().getShortName(), new AsyncCallbackSimple<Boolean>() {
@Override
- public void onSuccess(final Void arg) {
+ public void onSuccess(final Boolean arg) {
NotifyUser.hideProgress();
stateManager.refreshCurrentStateWithoutCache();
// issue #73
Modified: trunk/src/main/java/cc/kune/gspace/client/tool/selector/ToolSelectorPanel.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/tool/selector/ToolSelectorPanel.java 2012-02-28 02:09:40 UTC (rev 1718)
+++ trunk/src/main/java/cc/kune/gspace/client/tool/selector/ToolSelectorPanel.java 2012-02-28 18:56:19 UTC (rev 1719)
@@ -19,7 +19,7 @@
*/
package cc.kune.gspace.client.tool.selector;
-import cc.kune.core.client.dnd.FolderViewerDropController;
+import cc.kune.core.client.dnd.FolderContainerDropController;
import cc.kune.gspace.client.armor.GSpaceArmor;
import cc.kune.gspace.client.tool.selector.ToolSelectorItemPresenter.ToolSelectorItemView;
import cc.kune.gspace.client.tool.selector.ToolSelectorPresenter.ToolSelectorView;
@@ -40,14 +40,14 @@
private static ToolSelectorPanelUiBinder uiBinder = GWT.create(ToolSelectorPanelUiBinder.class);
- private final Provider<FolderViewerDropController> dropControllerProv;
+ private final Provider<FolderContainerDropController> dropControllerProv;
@UiField
FlowPanel flow;
@Inject
public ToolSelectorPanel(final GSpaceArmor wsArmor,
- final Provider<FolderViewerDropController> dropControllerProv) {
+ final Provider<FolderContainerDropController> dropControllerProv) {
this.dropControllerProv = dropControllerProv;
wsArmor.getEntityToolsCenter().add(uiBinder.createAndBindUi(this));
}
Modified: trunk/src/main/java/cc/kune/gspace/client/viewers/AbstractFolderViewerPanel.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/viewers/AbstractFolderViewerPanel.java 2012-02-28 02:09:40 UTC (rev 1718)
+++ trunk/src/main/java/cc/kune/gspace/client/viewers/AbstractFolderViewerPanel.java 2012-02-28 18:56:19 UTC (rev 1719)
@@ -25,7 +25,8 @@
import cc.kune.common.client.ui.UiUtils;
import cc.kune.common.shared.i18n.I18nTranslationService;
import cc.kune.common.shared.utils.Pair;
-import cc.kune.core.client.dnd.FolderViewerDropController;
+import cc.kune.core.client.dnd.FolderContainerDropController;
+import cc.kune.core.client.dnd.FolderContentDropController;
import cc.kune.core.client.dnd.KuneDragController;
import cc.kune.core.client.registry.ContentCapabilitiesRegistry;
import cc.kune.core.shared.dto.StateContainerDTO;
@@ -45,9 +46,10 @@
public abstract class AbstractFolderViewerPanel extends ViewImpl implements FolderViewerView {
protected final ContentCapabilitiesRegistry capabilitiesRegistry;
+ protected final Provider<FolderContainerDropController> containerDropControllerProv;
+ protected final Provider<FolderContentDropController> contentDropControllerProv;
private final ContentTitleWidget contentTitle;
protected final KuneDragController dragController;
- protected final Provider<FolderViewerDropController> dropControllerProv;
private final InlineLabel emptyLabel;
private final FlowPanel emptyPanel;
protected final GSpaceArmor gsArmor;
@@ -58,12 +60,15 @@
public AbstractFolderViewerPanel(final GSpaceArmor gsArmor, final EventBus eventBus,
final I18nTranslationService i18n, final ContentCapabilitiesRegistry capabilitiesRegistry,
final KuneDragController dragController,
- final Provider<FolderViewerDropController> dropControllerProv, final TutorialViewer tutorialViewer) {
+ final Provider<FolderContentDropController> contentDropControllerProv,
+ final Provider<FolderContainerDropController> containerDropControllerProv,
+ final TutorialViewer tutorialViewer) {
this.gsArmor = gsArmor;
this.i18n = i18n;
this.capabilitiesRegistry = capabilitiesRegistry;
this.dragController = dragController;
- this.dropControllerProv = dropControllerProv;
+ this.contentDropControllerProv = contentDropControllerProv;
+ this.containerDropControllerProv = containerDropControllerProv;
this.tutorialViewer = tutorialViewer;
emptyPanel = new FlowPanel();
emptyLabel = new InlineLabel(i18n.t("This is empty."));
Added: trunk/src/main/java/cc/kune/gspace/client/viewers/ContentDropController.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/viewers/ContentDropController.java (rev 0)
+++ trunk/src/main/java/cc/kune/gspace/client/viewers/ContentDropController.java 2012-02-28 18:56:19 UTC (rev 1719)
@@ -0,0 +1,67 @@
+package cc.kune.gspace.client.viewers;
+
+import cc.kune.common.shared.i18n.I18nTranslationService;
+import cc.kune.core.client.dnd.AbstractDropController;
+import cc.kune.core.client.dnd.KuneDragController;
+import cc.kune.core.client.rpcservices.AsyncCallbackSimple;
+import cc.kune.core.client.rpcservices.ContentServiceAsync;
+import cc.kune.core.client.state.Session;
+import cc.kune.core.client.ui.BasicDragableThumb;
+import cc.kune.core.shared.domain.utils.StateToken;
+
+import com.allen_sauer.gwt.dnd.client.drop.SimpleDropController;
+import com.google.gwt.user.client.ui.Widget;
+import com.google.inject.Inject;
+import com.google.inject.Singleton;
+
+/**
+ * The Class ContentDropController is used to allow the drop of users as
+ * participants to waves
+ */
+ at Singleton
+public class ContentDropController extends AbstractDropController {
+
+ private final ContentServiceAsync contentService;
+ private final I18nTranslationService i18n;
+ private final Session session;
+
+ /**
+ * Instantiates a new content drop controller.
+ *
+ * @param dragController
+ * the drag controller
+ */
+ @Inject
+ public ContentDropController(final KuneDragController dragController,
+ final ContentServiceAsync contentService, final Session session, final I18nTranslationService i18n) {
+ super(dragController);
+ this.contentService = contentService;
+ this.session = session;
+ this.i18n = i18n;
+ registerType(BasicDragableThumb.class);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * cc.kune.core.client.dnd.AbstractDropController#onDropAllowed(com.google
+ * .gwt.user.client.ui.Widget,
+ * com.allen_sauer.gwt.dnd.client.drop.SimpleDropController)
+ */
+ @Override
+ public void onDropAllowed(final Widget widget, final SimpleDropController dropController) {
+ final BasicDragableThumb thumb = (BasicDragableThumb) widget;
+ contentService.addParticipant(session.getUserHash(), (StateToken) getTarget(),
+ thumb.getToken().getGroup(), new AsyncCallbackSimple<Boolean>() {
+ @Override
+ public void onSuccess(final Boolean result) {
+ }
+ });
+ }
+
+ @Override
+ public void onGroupDropFinished(final SimpleDropController dropController) {
+ }
+
+}
Modified: trunk/src/main/java/cc/kune/gspace/client/viewers/ContentViewerPanel.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/viewers/ContentViewerPanel.java 2012-02-28 02:09:40 UTC (rev 1718)
+++ trunk/src/main/java/cc/kune/gspace/client/viewers/ContentViewerPanel.java 2012-02-28 18:56:19 UTC (rev 1719)
@@ -77,6 +77,7 @@
private final ContentTitleWidget contentTitle;
@UiField
DeckPanel deck;
+ private final ContentDropController dropController;
private final GSpaceArmor gsArmor;
private final I18nTranslationService i18n;
private IdGenerator idGenerator;
@@ -84,6 +85,7 @@
@UiField
InlineHTML onlyViewPanel;
private ProfileManager profiles;
+
private final StateManager stateManager;
/** The wave panel, if a wave is open. */
@@ -92,21 +94,23 @@
private final WaveClientProvider waveClientProv;
private ImplPanel waveHolder;
-
@UiField
ImplPanel waveHolderParent;
private final WaveStore waveStore = new SimpleWaveStore();
+
private final Widget widget;
@Inject
public ContentViewerPanel(final GSpaceArmor wsArmor, final WaveClientProvider waveClient,
final ContentCapabilitiesRegistry capabilitiesRegistry, final I18nTranslationService i18n,
- final EventBus eventBus, final StateManager stateManager) {
+ final EventBus eventBus, final StateManager stateManager,
+ final ContentDropController dropController) {
this.gsArmor = wsArmor;
this.waveClientProv = waveClient;
this.capabilitiesRegistry = capabilitiesRegistry;
this.i18n = i18n;
this.stateManager = stateManager;
+ this.dropController = dropController;
widget = uiBinder.createAndBindUi(this);
contentTitle = new ContentTitleWidget(i18n, gsArmor, capabilitiesRegistry.getIconsRegistry());
eventBus.addHandler(WaveClientClearEvent.getType(),
@@ -167,6 +171,7 @@
final WaveClientView webClient = waveClientProv.get();
loading = webClient.getLoading();
waveHolder = webClient.getWaveHolder();
+ dropController.init(waveHolder);
channel = webClient.getChannel();
profiles = webClient.getProfiles();
idGenerator = ClientIdGenerator.create();
@@ -177,6 +182,9 @@
@Override
public void setContent(final StateContentDTO state) {
final boolean editable = state.getContentRights().isEditable();
+ if (editable) {
+ dropController.setTarget(state.getStateToken());
+ }
gsArmor.enableCenterScroll(true);
setTitle(state, editable);
onlyViewPanel.setHTML(SafeHtmlUtils.fromTrustedString(state.getContent()));
@@ -186,6 +194,7 @@
@Override
public void setEditableContent(final StateContentDTO state) {
gsArmor.enableCenterScroll(false);
+ dropController.setTarget(state.getStateToken());
setTitle(state, true);
setEditableWaveContent(state.getWaveRef(), false);
deck.showWidget(0);
Modified: trunk/src/main/java/cc/kune/gspace/client/viewers/FolderViewerAsFlowPanel.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/viewers/FolderViewerAsFlowPanel.java 2012-02-28 02:09:40 UTC (rev 1718)
+++ trunk/src/main/java/cc/kune/gspace/client/viewers/FolderViewerAsFlowPanel.java 2012-02-28 18:56:19 UTC (rev 1719)
@@ -24,10 +24,12 @@
import cc.kune.common.client.actions.ui.descrip.GuiActionDescrip;
import cc.kune.common.client.actions.ui.descrip.MenuDescriptor;
import cc.kune.common.shared.i18n.I18nTranslationService;
-import cc.kune.core.client.dnd.FolderViewerDropController;
+import cc.kune.core.client.dnd.FolderContainerDropController;
+import cc.kune.core.client.dnd.FolderContentDropController;
import cc.kune.core.client.dnd.KuneDragController;
import cc.kune.core.client.registry.ContentCapabilitiesRegistry;
import cc.kune.core.client.ui.BasicDragableThumb;
+import cc.kune.core.shared.domain.utils.StateToken;
import cc.kune.core.shared.dto.StateContainerDTO;
import cc.kune.gspace.client.armor.GSpaceArmor;
import cc.kune.gspace.client.viewers.items.FolderItemDescriptor;
@@ -58,9 +60,11 @@
public FolderViewerAsFlowPanel(final GSpaceArmor gsArmor, final EventBus eventBus,
final I18nTranslationService i18n, final ContentCapabilitiesRegistry capabilitiesRegistry,
final KuneDragController dragController,
- final Provider<FolderViewerDropController> dropControllerProv, final TutorialViewer tutorialViewer) {
- super(gsArmor, eventBus, i18n, capabilitiesRegistry, dragController, dropControllerProv,
- tutorialViewer);
+ final Provider<FolderContentDropController> contentDropControllerProv,
+ final Provider<FolderContainerDropController> containerDropControllerProv,
+ final TutorialViewer tutorialViewer) {
+ super(gsArmor, eventBus, i18n, capabilitiesRegistry, dragController, contentDropControllerProv,
+ containerDropControllerProv, tutorialViewer);
widget = uiBinder.createAndBindUi(this);
}
@@ -69,7 +73,7 @@
final DoubleClickHandler doubleClickHandler) {
// In this viewer we don't use the clickHandler from the presenter
flow.add(createThumb(item.getText(), item.getIcon(), item.getTooltip(), "",
- item.getActionCollection(), doubleClickHandler));
+ item.getActionCollection(), doubleClickHandler, item.getStateToken()));
}
@Override
@@ -80,9 +84,9 @@
public BasicDragableThumb createThumb(final String text, final Object icon, final String tooltip,
final String tooltipTitle, final GuiActionDescCollection menuitems,
- final DoubleClickHandler doubleClickHandler) {
+ final DoubleClickHandler doubleClickHandler, final StateToken token) {
final BasicDragableThumb thumb = new BasicDragableThumb(icon, ICONSIZE, text, ICONLABELMAXSIZE,
- false);
+ false, token);
final MenuDescriptor menu = new MenuDescriptor();
menu.setStandalone(true);
menu.putValue(AbstractGxtMenuGui.MENU_POSITION, AbstractGxtMenuGui.MenuPosition.bl);
Modified: trunk/src/main/java/cc/kune/gspace/client/viewers/FolderViewerAsTablePanel.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/viewers/FolderViewerAsTablePanel.java 2012-02-28 02:09:40 UTC (rev 1718)
+++ trunk/src/main/java/cc/kune/gspace/client/viewers/FolderViewerAsTablePanel.java 2012-02-28 18:56:19 UTC (rev 1719)
@@ -28,7 +28,8 @@
import cc.kune.common.client.actions.ui.descrip.MenuDescriptor;
import cc.kune.common.client.tooltip.Tooltip;
import cc.kune.common.shared.i18n.I18nTranslationService;
-import cc.kune.core.client.dnd.FolderViewerDropController;
+import cc.kune.core.client.dnd.FolderContainerDropController;
+import cc.kune.core.client.dnd.FolderContentDropController;
import cc.kune.core.client.dnd.KuneDragController;
import cc.kune.core.client.registry.ContentCapabilitiesRegistry;
import cc.kune.core.client.resources.CoreResources;
@@ -76,9 +77,11 @@
public FolderViewerAsTablePanel(final GSpaceArmor gsArmor, final I18nTranslationService i18n,
final EventBus eventBus, final GuiProvider guiProvider, final CoreResources res,
final ContentCapabilitiesRegistry capabilitiesRegistry, final KuneDragController dragController,
- final Provider<FolderViewerDropController> dropControllerProv, final TutorialViewer tutorialViewer) {
- super(gsArmor, eventBus, i18n, capabilitiesRegistry, dragController, dropControllerProv,
- tutorialViewer);
+ final Provider<FolderContentDropController> contentDropControllerProv,
+ final Provider<FolderContainerDropController> containerDropControllerProv,
+ final TutorialViewer tutorialViewer) {
+ super(gsArmor, eventBus, i18n, capabilitiesRegistry, dragController, contentDropControllerProv,
+ containerDropControllerProv, tutorialViewer);
this.guiProvider = guiProvider;
this.res = res;
widget = uiBinder.createAndBindUi(this);
@@ -155,16 +158,18 @@
flex.setWidget(rowCount + 1, 0, itemWidget);
if (item.isDraggable()) {
dragController.makeDraggable(itemWidget, itemWidget.getTitleWidget());
- // Tooltip.to(itemWidget,
- // i18n.t("Drag and drop to move this. Double click to open"));
- } else {
- // Tooltip.to(itemWidget, i18n.t("Double click to open"));
}
- if (item.isDroppable()) {
- final FolderViewerDropController dropController = dropControllerProv.get();
+
+ if (!item.isContainer() && item.isDroppable()) {
+ final FolderContentDropController dropController = contentDropControllerProv.get();
dropController.init(itemWidget);
dropController.setTarget(item.getStateToken());
}
+ if (item.isContainer() && item.isDroppable()) {
+ final FolderContainerDropController dropController = containerDropControllerProv.get();
+ dropController.init(itemWidget);
+ dropController.setTarget(item.getStateToken());
+ }
}
@Override
Modified: trunk/src/main/java/cc/kune/gspace/client/viewers/FolderViewerUtils.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/viewers/FolderViewerUtils.java 2012-02-28 02:09:40 UTC (rev 1718)
+++ trunk/src/main/java/cc/kune/gspace/client/viewers/FolderViewerUtils.java 2012-02-28 18:56:19 UTC (rev 1719)
@@ -72,7 +72,7 @@
private void addItem(final AbstractContentSimpleDTO content, final BasicMimeTypeDTO mimeType,
final ContentStatus status, final StateToken parentStateToken, final AccessRights rights,
- final long modifiedOn) {
+ final long modifiedOn, final boolean isContainer) {
final StateToken stateToken = content.getStateToken();
final String typeId = content.getTypeId();
final String name = content.getName();
@@ -89,7 +89,7 @@
genId(parentStateToken), icon, name, tooltip, status, stateToken, modifiedOn,
capabReg.isDragable(typeId) && rights.isAdministrable(), capabReg.isDropable(typeId)
&& rights.isAdministrable(), actionsRegistry.getCurrentActions(content, typeId, status,
- session.isLogged(), rights, ActionGroups.ITEM_MENU));
+ session.isLogged(), rights, ActionGroups.ITEM_MENU), isContainer);
getView().addItem(item, new ClickHandler() {
@Override
public void onClick(final ClickEvent event) {
@@ -124,13 +124,14 @@
for (final ContainerSimpleDTO childFolder : container.getChilds()) {
addItem(childFolder, null, ContentStatus.publishedOnline,
childFolder.getStateToken().copy().setFolder(childFolder.getParentFolderId()),
- containerRights, FolderViewerView.NO_DATE);
+ containerRights, FolderViewerView.NO_DATE, true);
}
// Other contents (docs, etc)
for (final ContentSimpleDTO content : container.getContents()) {
assert content != null;
addItem(content, content.getMimeType(), content.getStatus(),
- content.getStateToken().copy().clearDocument(), content.getRights(), content.getModifiedOn());
+ content.getStateToken().copy().clearDocument(), content.getRights(),
+ content.getModifiedOn(), false);
}
}
}
Modified: trunk/src/main/java/cc/kune/gspace/client/viewers/PathToolbarUtils.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/viewers/PathToolbarUtils.java 2012-02-28 02:09:40 UTC (rev 1718)
+++ trunk/src/main/java/cc/kune/gspace/client/viewers/PathToolbarUtils.java 2012-02-28 18:56:19 UTC (rev 1719)
@@ -23,7 +23,7 @@
import cc.kune.common.client.actions.ui.descrip.GuiActionDescCollection;
import cc.kune.common.shared.i18n.I18nTranslationService;
import cc.kune.common.shared.utils.TextUtils;
-import cc.kune.core.client.dnd.FolderViewerDropController;
+import cc.kune.core.client.dnd.FolderContainerDropController;
import cc.kune.core.client.registry.ContentCapabilitiesRegistry;
import cc.kune.core.client.registry.IconsRegistry;
import cc.kune.core.client.state.StateManager;
@@ -37,14 +37,14 @@
public class PathToolbarUtils {
- private final Provider<FolderViewerDropController> dropController;
+ private final Provider<FolderContainerDropController> dropController;
private final EventBus eventBus;
private final I18nTranslationService i18n;
private final IconsRegistry iconsRegistry;
private final StateManager stateManager;
@Inject
- public PathToolbarUtils(final Provider<FolderViewerDropController> dropController,
+ public PathToolbarUtils(final Provider<FolderContainerDropController> dropController,
final StateManager stateManager, final ContentCapabilitiesRegistry capabilitiesRegistry,
final EventBus eventBus, final I18nTranslationService i18n) {
this.dropController = dropController;
@@ -78,7 +78,7 @@
final ButtonDescriptor btn = createPathButton(path[i], pathLength, i);
if (withDrop) {
if (i != pathLength - 1) {
- final FolderViewerDropController dropTarget = dropController.get();
+ final FolderContainerDropController dropTarget = dropController.get();
dropTarget.setTarget(path[i].getStateToken());
btn.setDropTarget(dropTarget);
}
Modified: trunk/src/main/java/cc/kune/gspace/client/viewers/items/FolderItemDescriptor.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/viewers/items/FolderItemDescriptor.java 2012-02-28 02:09:40 UTC (rev 1718)
+++ trunk/src/main/java/cc/kune/gspace/client/viewers/items/FolderItemDescriptor.java 2012-02-28 18:56:19 UTC (rev 1719)
@@ -30,6 +30,7 @@
private final ContentStatus contentStatus;
private final Object icon;
private final String id;
+ private final boolean isContainer;
private final long modififiedOn;
private final String parentId;
private final String text;
@@ -39,7 +40,7 @@
public FolderItemDescriptor(final String id, final String parentId, final Object icon,
final String text, final String tooltip, final ContentStatus contentStatus,
final StateToken token, final long modififiedOn, final boolean allowDrag, final boolean allowDrop,
- final GuiActionDescCollection actionCollection) {
+ final GuiActionDescCollection actionCollection, final boolean isContainer) {
this.id = id;
this.parentId = parentId;
this.icon = icon;
@@ -51,6 +52,7 @@
this.allowDrag = allowDrag;
this.allowDrop = allowDrop;
this.actionCollection = actionCollection;
+ this.isContainer = isContainer;
}
public GuiActionDescCollection getActionCollection() {
@@ -89,6 +91,10 @@
return tooltip;
}
+ public boolean isContainer() {
+ return isContainer;
+ }
+
public boolean isDraggable() {
return allowDrag;
}
Modified: trunk/src/main/java/cc/kune/tasks/client/TasksClientTool.java
===================================================================
--- trunk/src/main/java/cc/kune/tasks/client/TasksClientTool.java 2012-02-28 02:09:40 UTC (rev 1718)
+++ trunk/src/main/java/cc/kune/tasks/client/TasksClientTool.java 2012-02-28 18:56:19 UTC (rev 1719)
@@ -69,7 +69,7 @@
private void registerIcons() {
registerTutorial(TYPE_ROOT);
- registerTutorial(TYPE_FOLDER);
+ // registerTutorial(TYPE_FOLDER);
registerContentTypeIcon(TYPE_ROOT, icons.tasks());
registerContentTypeIcon(TYPE_FOLDER, navResources.taskfolder());
registerContentTypeIcon(TYPE_TASK, navResources.task());
Modified: trunk/src/main/java/cc/kune/wave/server/kspecific/KuneAgent.java
===================================================================
--- trunk/src/main/java/cc/kune/wave/server/kspecific/KuneAgent.java 2012-02-28 02:09:40 UTC (rev 1718)
+++ trunk/src/main/java/cc/kune/wave/server/kspecific/KuneAgent.java 2012-02-28 18:56:19 UTC (rev 1719)
@@ -68,10 +68,10 @@
}
@Override
- public void addParticipants(final WaveRef waveName, final String author, final String userWhoAdd,
+ public boolean addParticipants(final WaveRef waveName, final String author, final String userWhoAdd,
final String... newParticipants) {
// TODO Auto-generated method stub
-
+ return false;
}
@Override
Modified: trunk/src/main/java/cc/kune/wave/server/kspecific/KuneWaveService.java
===================================================================
--- trunk/src/main/java/cc/kune/wave/server/kspecific/KuneWaveService.java 2012-02-28 02:09:40 UTC (rev 1718)
+++ trunk/src/main/java/cc/kune/wave/server/kspecific/KuneWaveService.java 2012-02-28 18:56:19 UTC (rev 1719)
@@ -46,7 +46,7 @@
void addGadget(WaveRef waveName, String author, URL gadgetUrl);
- void addParticipants(WaveRef waveName, String author, String userWhoAdd, String... newParticipants);
+ boolean addParticipants(WaveRef waveName, String author, String userWhoAdd, String... newParticipants);
WaveRef createWave(String message, SimpleArgCallback<WaveRef> onCreate, ParticipantId... participants);
Modified: trunk/src/main/java/cc/kune/wave/server/kspecific/KuneWaveServiceDefault.java
===================================================================
--- trunk/src/main/java/cc/kune/wave/server/kspecific/KuneWaveServiceDefault.java 2012-02-28 02:09:40 UTC (rev 1718)
+++ trunk/src/main/java/cc/kune/wave/server/kspecific/KuneWaveServiceDefault.java 2012-02-28 18:56:19 UTC (rev 1719)
@@ -190,8 +190,9 @@
}
@Override
- public void addParticipants(final WaveRef waveName, final String author, final String userWhoAdds,
+ public boolean addParticipants(final WaveRef waveName, final String author, final String userWhoAdds,
final String... newLocalParticipants) {
+ boolean added = false;
final Wavelet wavelet = fetchWave(waveName, author);
final Participants currentParticipants = wavelet.getParticipants();
// Removing duplicates
@@ -207,8 +208,10 @@
final String whoAdd = wavelet.getParticipants().contains(participantUtils.of(userWhoAdds)) ? userWhoAdds
: author;
doOperation(whoAdd, opQueue, "add participant");
+ added = true;
}
}
+ return added;
}
@Override
Modified: trunk/src/main/java/cc/kune/wiki/client/WikiClientTool.java
===================================================================
--- trunk/src/main/java/cc/kune/wiki/client/WikiClientTool.java 2012-02-28 02:09:40 UTC (rev 1718)
+++ trunk/src/main/java/cc/kune/wiki/client/WikiClientTool.java 2012-02-28 18:56:19 UTC (rev 1719)
@@ -68,7 +68,7 @@
private void registerIcons() {
registerTutorial(TYPE_ROOT);
- registerTutorial(TYPE_FOLDER);
+ // registerTutorial(TYPE_FOLDER);
registerContentTypeIcon(TYPE_FOLDER, navResources.folder());
registerContentTypeIcon(TYPE_ROOT, icons.wikis());
registerContentTypeIcon(TYPE_WIKIPAGE, navResources.wikipage());
More information about the kune-commits
mailing list