diff options
author | Matti Tahvonen <matti.tahvonen@itmill.com> | 2010-02-19 13:57:33 +0000 |
---|---|---|
committer | Matti Tahvonen <matti.tahvonen@itmill.com> | 2010-02-19 13:57:33 +0000 |
commit | 1640902d0c533354034f75b050849de982a2d99a (patch) | |
tree | edaeb3d98ce8f297fbadc0611210d6903a3ce2e8 /src/com/vaadin/ui/DragAndDropWrapper.java | |
parent | 7ce8cb30bff4d1ff8b90c3be00dabf6f6fc66f01 (diff) | |
download | vaadin-framework-1640902d0c533354034f75b050849de982a2d99a.tar.gz vaadin-framework-1640902d0c533354034f75b050849de982a2d99a.zip |
removed component transferable (integrated to transferable), changed one test to use draganddropwrapper instead of dragdroppane (to be removed)
svn changeset:11407/svn branch:6.3_dd
Diffstat (limited to 'src/com/vaadin/ui/DragAndDropWrapper.java')
-rw-r--r-- | src/com/vaadin/ui/DragAndDropWrapper.java | 70 |
1 files changed, 64 insertions, 6 deletions
diff --git a/src/com/vaadin/ui/DragAndDropWrapper.java b/src/com/vaadin/ui/DragAndDropWrapper.java index e2fb2942e7..232c65f9c6 100644 --- a/src/com/vaadin/ui/DragAndDropWrapper.java +++ b/src/com/vaadin/ui/DragAndDropWrapper.java @@ -2,23 +2,27 @@ package com.vaadin.ui; import java.util.Map; -import com.vaadin.event.ComponentTransferable; +import com.vaadin.event.TransferableImpl; import com.vaadin.event.Transferable; import com.vaadin.event.dd.DragSource; import com.vaadin.event.dd.DropHandler; import com.vaadin.event.dd.DropTarget; import com.vaadin.event.dd.DropTargetDetails; +import com.vaadin.event.dd.DropTargetDetailsImpl; import com.vaadin.terminal.PaintException; import com.vaadin.terminal.PaintTarget; +import com.vaadin.terminal.gwt.client.MouseEventDetails; import com.vaadin.terminal.gwt.client.ui.VDragAndDropWrapper; +import com.vaadin.terminal.gwt.client.ui.dd.HorizontalDropLocation; +import com.vaadin.terminal.gwt.client.ui.dd.VerticalDropLocation; @ClientWidget(VDragAndDropWrapper.class) public class DragAndDropWrapper extends CustomComponent implements DropTarget, DragSource { - public class DDWrapperTransferable extends ComponentTransferable { + public class WrapperTransferable extends TransferableImpl { - public DDWrapperTransferable(Component sourceComponent, + public WrapperTransferable(Component sourceComponent, Map<String, Object> rawVariables) { super(sourceComponent, rawVariables); } @@ -33,6 +37,61 @@ public class DragAndDropWrapper extends CustomComponent implements DropTarget, Component object = (Component) getData("component"); return object; } + + /** + * @return the mouse down event that started the drag and drop operation + */ + public MouseEventDetails getMouseDownEvent() { + return MouseEventDetails.deSerialize((String) getData("mouseDown")); + } + + } + + public class WrapperDropDetails extends DropTargetDetailsImpl { + + /** + * + */ + private static final long serialVersionUID = 1L; + + public WrapperDropDetails(Map<String, Object> rawDropData) { + super(rawDropData); + } + + /** + * @return the absolute position of wrapper on the page + */ + public Integer getAbsoluteLeft() { + return (Integer) getData("absoluteLeft"); + } + + /** + * + * @return the absolute position of wrapper on the page + */ + public Integer getAbsoluteTop() { + return (Integer) getData("absoluteTop"); + } + + /** + * @return details about the actual event that caused the event details. + * Practically mouse move or mouse up. + */ + public MouseEventDetails getMouseEvent() { + return MouseEventDetails + .deSerialize((String) getData("mouseEvent")); + } + + public VerticalDropLocation verticalDropLocation() { + return VerticalDropLocation + .valueOf((String) getData("verticalLocation")); + } + + public HorizontalDropLocation horizontalDropLocation() { + return HorizontalDropLocation + .valueOf((String) getData("horizontalLocation")); + } + } public enum DragStartMode { @@ -71,12 +130,11 @@ public class DragAndDropWrapper extends CustomComponent implements DropTarget, public DropTargetDetails translateDragDropDetails( Map<String, Object> clientVariables) { - // TODO Auto-generated method stub - return null; + return new WrapperDropDetails(clientVariables); } public Transferable getTransferable(final Map<String, Object> rawVariables) { - return new DDWrapperTransferable(this, rawVariables); + return new WrapperTransferable(this, rawVariables); } public void setDragStartMode(DragStartMode dragStartMode) { |