diff options
author | Matti Tahvonen <matti.tahvonen@itmill.com> | 2010-02-15 15:05:56 +0000 |
---|---|---|
committer | Matti Tahvonen <matti.tahvonen@itmill.com> | 2010-02-15 15:05:56 +0000 |
commit | 020312bc89558c8c5a28840dc979c6b80f64f912 (patch) | |
tree | b13cd2c91e3c3791657da4600777f4a88dab3512 /src/com/vaadin | |
parent | b3b04325f1b4bb84962752d466fd54e1b176dea3 (diff) | |
download | vaadin-framework-020312bc89558c8c5a28840dc979c6b80f64f912.tar.gz vaadin-framework-020312bc89558c8c5a28840dc979c6b80f64f912.zip |
small changes
svn changeset:11324/svn branch:6.3_dd
Diffstat (limited to 'src/com/vaadin')
4 files changed, 30 insertions, 17 deletions
diff --git a/src/com/vaadin/event/dd/acceptCriteria/OverTreeNode.java b/src/com/vaadin/event/dd/acceptCriteria/OverTreeNode.java index e1bcf506b8..80321ef963 100644 --- a/src/com/vaadin/event/dd/acceptCriteria/OverTreeNode.java +++ b/src/com/vaadin/event/dd/acceptCriteria/OverTreeNode.java @@ -16,9 +16,6 @@ import com.vaadin.ui.Tree.TreeDropDetails; */ public class OverTreeNode extends ClientSideCriterion { - /** - * - */ private static final long serialVersionUID = 1L; public boolean accepts(DragAndDropEvent dragEvent) { diff --git a/src/com/vaadin/terminal/gwt/client/ui/VTree.java b/src/com/vaadin/terminal/gwt/client/ui/VTree.java index 1eb2867a6b..1a3edd32be 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VTree.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VTree.java @@ -167,7 +167,8 @@ public class VTree extends FlowPanel implements Paintable, VHasDropHandler { if (currentMouseOverKey != null) { String detail = getDropDetail(drag.getCurrentGwtEvent()); Boolean overTreeNode = null; - if (!keyToNode.get(currentMouseOverKey).isLeaf() + TreeNode treeNode = keyToNode.get(currentMouseOverKey); + if (treeNode != null && !treeNode.isLeaf() && "Center".equals(detail)) { overTreeNode = true; } @@ -243,7 +244,10 @@ public class VTree extends FlowPanel implements Paintable, VHasDropHandler { }, currentDrag); if (oldIdOver != null && oldIdOver != currentMouseOverKey) { - keyToNode.get(oldIdOver).emphasis(null); + TreeNode treeNode = keyToNode.get(oldIdOver); + if (treeNode != null) { + treeNode.emphasis(null); + } } } diff --git a/src/com/vaadin/terminal/gwt/client/ui/dd/VDragAndDropManager.java b/src/com/vaadin/terminal/gwt/client/ui/dd/VDragAndDropManager.java index 027a03eeda..69053f45ec 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/dd/VDragAndDropManager.java +++ b/src/com/vaadin/terminal/gwt/client/ui/dd/VDragAndDropManager.java @@ -7,7 +7,6 @@ import com.google.gwt.dom.client.NativeEvent; import com.google.gwt.dom.client.Node; import com.google.gwt.dom.client.Style; import com.google.gwt.dom.client.Style.Display; -import com.google.gwt.dom.client.Style.Position; import com.google.gwt.dom.client.Style.Unit; import com.google.gwt.event.shared.HandlerRegistration; import com.google.gwt.user.client.Command; @@ -575,9 +574,7 @@ public class VDragAndDropManager { } dragElement = node; - Style style = node.getStyle(); - style.setPosition(Position.ABSOLUTE); - style.setZIndex(600000); + dragElement.addClassName("v-drag-element"); updateDragImagePosition(); if (isStarted) { diff --git a/src/com/vaadin/terminal/gwt/client/ui/dd/VDragEvent.java b/src/com/vaadin/terminal/gwt/client/ui/dd/VDragEvent.java index d75e4e0355..3b94fcb606 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/dd/VDragEvent.java +++ b/src/com/vaadin/terminal/gwt/client/ui/dd/VDragEvent.java @@ -101,7 +101,11 @@ public class VDragEvent { } /** - * Sets the element that will be used as "drag icon". + * Sets the drag image used for current drag and drop operation. Drag image + * is displayed next to mouse cursor during drag and drop. + * <p> + * The element to be used as drag image will automatically get CSS style + * name "v-drag-element". * * TODO decide if this method should be here or in {@link VTransferable} (in * HTML5 it is in DataTransfer) or {@link VDragAndDropManager} @@ -126,10 +130,24 @@ public class VDragEvent { return dropDetails; } - public void setDragImage(Element cloneNode, int offsetX, int offsetY) { - cloneNode.getStyle().setMarginLeft(offsetX, Unit.PX); - cloneNode.getStyle().setMarginTop(offsetY, Unit.PX); - VDragAndDropManager.get().setDragElement(cloneNode); + /** + * Sets the drag image used for current drag and drop operation. Drag image + * is displayed next to mouse cursor during drag and drop. + * <p> + * The element to be used as drag image will automatically get CSS style + * name "v-drag-element". + * + * @param element + * the dom element to be positioned next to mouse cursor + * @param offsetX + * the horizontal offset of drag image from mouse cursor + * @param offsetY + * the vertical offset of drag image from mouse cursor + */ + public void setDragImage(Element element, int offsetX, int offsetY) { + element.getStyle().setMarginLeft(offsetX, Unit.PX); + element.getStyle().setMarginTop(offsetY, Unit.PX); + VDragAndDropManager.get().setDragElement(element); } @@ -151,10 +169,7 @@ public class VDragEvent { tbody.appendChild(cloneNode); cloneNode = table.cast(); } - cloneNode.getStyle().setProperty("filter", "alpha(opacity=40)"); } - cloneNode.getStyle().setOpacity(0.4); - if (alignImageToEvent) { int absoluteTop = element.getAbsoluteTop(); int absoluteLeft = element.getAbsoluteLeft(); |