[kune-commits] r1476 - in trunk/src/main/java/cc/kune: common/client/tooltip core/client/dnd core/client/errors core/public core/server/content gspace/client/viewers
Vicente J. Ruiz Jurado
vjrj_ at ourproject.org
Fri Jul 29 22:59:41 CEST 2011
Author: vjrj_
Date: 2011-07-29 22:59:39 +0200 (Fri, 29 Jul 2011)
New Revision: 1476
Added:
trunk/src/main/java/cc/kune/core/client/errors/MoveOnSameContainerException.java
Modified:
trunk/src/main/java/cc/kune/common/client/tooltip/Tooltip.java
trunk/src/main/java/cc/kune/core/client/dnd/FolderViewerDropController.java
trunk/src/main/java/cc/kune/core/client/errors/ErrorHandler.java
trunk/src/main/java/cc/kune/core/public/ws.css
trunk/src/main/java/cc/kune/core/server/content/ContainerManagerDefault.java
trunk/src/main/java/cc/kune/core/server/content/ContentManagerDefault.java
trunk/src/main/java/cc/kune/gspace/client/viewers/FolderViewerAsTablePanel.java
trunk/src/main/java/cc/kune/gspace/client/viewers/FolderViewerPresenter.java
Log:
Folder/content move minor changes
Modified: trunk/src/main/java/cc/kune/common/client/tooltip/Tooltip.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/tooltip/Tooltip.java 2011-07-29 19:44:18 UTC (rev 1475)
+++ trunk/src/main/java/cc/kune/common/client/tooltip/Tooltip.java 2011-07-29 20:59:39 UTC (rev 1476)
@@ -48,6 +48,8 @@
interface TooltipUiBinder extends UiBinder<Widget, Tooltip> {
}
+ static Tooltip current;
+
private static TooltipUiBinder uiBinder = GWT.create(TooltipUiBinder.class);
private static final int WIDTH_NOT_DEFINED = -1;
@@ -146,6 +148,10 @@
public void show() {
if (!Tooltip.this.isShowing() && ofWidget.isAttached() && ofWidget.isVisible()) {
Tooltip.super.show();
+ if (Tooltip.current != null) {
+ Tooltip.current.hide();
+ }
+ Tooltip.current = this;
Tooltip.this.showAt(TooltipPositionCalculator.calculate(Window.getClientWidth(),
Window.getClientHeight(), ofWidget.getAbsoluteLeft(), ofWidget.getAbsoluteTop(),
ofWidget.getOffsetWidth(), ofWidget.getOffsetHeight(), Tooltip.this.getWidth(),
Modified: trunk/src/main/java/cc/kune/core/client/dnd/FolderViewerDropController.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/dnd/FolderViewerDropController.java 2011-07-29 19:44:18 UTC (rev 1475)
+++ trunk/src/main/java/cc/kune/core/client/dnd/FolderViewerDropController.java 2011-07-29 20:59:39 UTC (rev 1476)
@@ -64,6 +64,7 @@
NotifyUser.showProgress(i18n.t("Moving"));
if (target != null) {
final StateToken destToken = (StateToken) target;
+ widget.removeFromParent();
contentService.moveContent(session.getUserHash(), ((FolderItemWidget) widget).getToken(),
destToken, new AsyncCallback<StateContainerDTO>() {
@Override
@@ -75,7 +76,6 @@
@Override
public void onSuccess(final StateContainerDTO result) {
- stateManager.refreshCurrentState();
NotifyUser.hideProgress();
}
});
Modified: trunk/src/main/java/cc/kune/core/client/errors/ErrorHandler.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/errors/ErrorHandler.java 2011-07-29 19:44:18 UTC (rev 1475)
+++ trunk/src/main/java/cc/kune/core/client/errors/ErrorHandler.java 2011-07-29 20:59:39 UTC (rev 1476)
@@ -132,6 +132,10 @@
logException(caught);
eventBus.fireEvent(new UserNotifyEvent(NotifyLevel.error,
i18n.t("This user is already a group member")));
+ } else if (caught instanceof MoveOnSameContainerException) {
+ logException(caught);
+ eventBus.fireEvent(new UserNotifyEvent(NotifyLevel.info,
+ i18n.t("You are trying to move this to the same location")));
} else if (caught instanceof UnderDevelopmentException) {
logException(caught);
eventBus.fireEvent(new UserNotifyEvent(NotifyLevel.info, i18n.t(TextUtils.IN_DEVELOPMENT)));
Added: trunk/src/main/java/cc/kune/core/client/errors/MoveOnSameContainerException.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/errors/MoveOnSameContainerException.java (rev 0)
+++ trunk/src/main/java/cc/kune/core/client/errors/MoveOnSameContainerException.java 2011-07-29 20:59:39 UTC (rev 1476)
@@ -0,0 +1,24 @@
+/*
+ *
+ * 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.errors;
+
+public class MoveOnSameContainerException extends DefaultException {
+ private static final long serialVersionUID = -4785135366930710863L;
+}
Modified: trunk/src/main/java/cc/kune/core/public/ws.css
===================================================================
--- trunk/src/main/java/cc/kune/core/public/ws.css 2011-07-29 19:44:18 UTC (rev 1475)
+++ trunk/src/main/java/cc/kune/core/public/ws.css 2011-07-29 20:59:39 UTC (rev 1476)
@@ -1430,5 +1430,5 @@
button.k-drop-allowed-hover,
.k-drop-allowed-hover {
- border: dashed 2px #3a9fd6;
+ border: dashed 2px #3a9fd6 !important;
}
\ No newline at end of file
Modified: trunk/src/main/java/cc/kune/core/server/content/ContainerManagerDefault.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/content/ContainerManagerDefault.java 2011-07-29 19:44:18 UTC (rev 1475)
+++ trunk/src/main/java/cc/kune/core/server/content/ContainerManagerDefault.java 2011-07-29 20:59:39 UTC (rev 1476)
@@ -28,6 +28,7 @@
import cc.kune.core.client.errors.AccessViolationException;
import cc.kune.core.client.errors.DefaultException;
+import cc.kune.core.client.errors.MoveOnSameContainerException;
import cc.kune.core.client.errors.NameInUseException;
import cc.kune.core.server.manager.file.FileUtils;
import cc.kune.core.server.manager.impl.DefaultManager;
@@ -98,11 +99,10 @@
@Override
public void moveContainer(final Container container, final Container newContainer) {
- final String title = container.getName();
if (newContainer.equals(container.getParent())) {
- // Do nothing (trying to move to the same location)
- return;
+ throw new MoveOnSameContainerException();
}
+ final String title = container.getName();
if (findIfExistsTitle(newContainer, title)) {
throw new NameInUseException();
}
Modified: trunk/src/main/java/cc/kune/core/server/content/ContentManagerDefault.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/content/ContentManagerDefault.java 2011-07-29 19:44:18 UTC (rev 1475)
+++ trunk/src/main/java/cc/kune/core/server/content/ContentManagerDefault.java 2011-07-29 20:59:39 UTC (rev 1476)
@@ -35,6 +35,7 @@
import cc.kune.core.client.errors.DefaultException;
import cc.kune.core.client.errors.I18nNotFoundException;
+import cc.kune.core.client.errors.MoveOnSameContainerException;
import cc.kune.core.client.errors.NameInUseException;
import cc.kune.core.client.errors.UserNotFoundException;
import cc.kune.core.server.access.FinderService;
@@ -190,7 +191,11 @@
}
}
+ @Override
public Content moveContent(final Content content, final Container newContainer) {
+ if (newContainer.equals(content.getContainer())) {
+ throw new MoveOnSameContainerException();
+ }
final String title = content.getTitle();
if (findIfExistsTitle(newContainer, title)) {
throw new NameInUseException();
Modified: trunk/src/main/java/cc/kune/gspace/client/viewers/FolderViewerAsTablePanel.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/viewers/FolderViewerAsTablePanel.java 2011-07-29 19:44:18 UTC (rev 1475)
+++ trunk/src/main/java/cc/kune/gspace/client/viewers/FolderViewerAsTablePanel.java 2011-07-29 20:59:39 UTC (rev 1476)
@@ -26,7 +26,6 @@
import cc.kune.common.client.actions.ui.descrip.GuiActionDescCollection;
import cc.kune.common.client.actions.ui.descrip.GuiActionDescrip;
import cc.kune.common.client.actions.ui.descrip.MenuDescriptor;
-import cc.kune.common.client.tooltip.Tooltip;
import cc.kune.core.client.dnd.FolderViewerDropController;
import cc.kune.core.client.dnd.KuneDragController;
import cc.kune.core.client.registry.ContentCapabilitiesRegistry;
@@ -145,9 +144,10 @@
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"));
+ // 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"));
+ // Tooltip.to(itemWidget, i18n.t("Double click to open"));
}
if (item.isDroppable()) {
final FolderViewerDropController dropController = dropControllerProv.get();
Modified: trunk/src/main/java/cc/kune/gspace/client/viewers/FolderViewerPresenter.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/viewers/FolderViewerPresenter.java 2011-07-29 19:44:18 UTC (rev 1475)
+++ trunk/src/main/java/cc/kune/gspace/client/viewers/FolderViewerPresenter.java 2011-07-29 20:59:39 UTC (rev 1476)
@@ -239,6 +239,11 @@
if (pathLength > 0) {
for (int i = pathLength - 1; i >= 0; i--) {
final ButtonDescriptor btn = createPathButton(path[i], pathLength, i);
+ if (i != pathLength - 1) {
+ final FolderViewerDropController dropTarget = dropController.get();
+ dropTarget.setTarget(path[i].getStateToken());
+ btn.setDropTarget(dropTarget);
+ }
actions.add(btn);
}
}
@@ -251,9 +256,6 @@
final ButtonDescriptor btn = new ButtonDescriptor(new GotoTokenAction(
iconsRegistry.getContentTypeIcon(container.getTypeId()), container.getName(),
container.getStateToken(), style, stateManager, getEventBus()));
- final FolderViewerDropController dropTarget = dropController.get();
- dropTarget.setTarget(container.getStateToken());
- btn.setDropTarget(dropTarget);
return btn;
}
More information about the kune-commits
mailing list