aboutsummaryrefslogtreecommitdiffstats
path: root/src/com/vaadin
diff options
context:
space:
mode:
authorMatti Tahvonen <matti.tahvonen@itmill.com>2010-02-09 09:43:58 +0000
committerMatti Tahvonen <matti.tahvonen@itmill.com>2010-02-09 09:43:58 +0000
commitac88783e91f6d4a40280d5c345fd4bd83ed4051d (patch)
tree129b6f68f6763d2f75d5fecfb37c12ebdc1d664e /src/com/vaadin
parentb1ac1c20a55c6286465f06aba3d9f8984b4d726d (diff)
downloadvaadin-framework-ac88783e91f6d4a40280d5c345fd4bd83ed4051d.tar.gz
vaadin-framework-ac88783e91f6d4a40280d5c345fd4bd83ed4051d.zip
Cleanup, removing some obsolete methods
svn changeset:11227/svn branch:6.3_dd
Diffstat (limited to 'src/com/vaadin')
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java2
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/VTree.java36
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/dd/VAbstractDropHandler.java92
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/dd/VAcceptCallback.java12
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/dd/VAcceptCriterion.java3
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/dd/VAcceptCriterionImpl.java6
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/dd/VDragAndDropManager.java184
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/dd/VDragEvent.java29
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/dd/VHtml5DragEvent.java4
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/dd/VTransferable.java59
10 files changed, 216 insertions, 211 deletions
diff --git a/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java b/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java
index 88e8da5147..f878dbd954 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java
@@ -2502,7 +2502,7 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler {
if (mDown && dragmode != 0) {
VTransferable transferable = new VTransferable();
transferable.setComponent(VScrollTable.this);
- transferable.setItemId("" + rowKey);
+ transferable.setData("itemId", "" + rowKey);
// TODO propertyId
VDragEvent ev = VDragAndDropManager.get()
diff --git a/src/com/vaadin/terminal/gwt/client/ui/VTree.java b/src/com/vaadin/terminal/gwt/client/ui/VTree.java
index dd91fcdcea..a9db71d83e 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/VTree.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/VTree.java
@@ -25,7 +25,6 @@ import com.vaadin.terminal.gwt.client.MouseEventDetails;
import com.vaadin.terminal.gwt.client.Paintable;
import com.vaadin.terminal.gwt.client.UIDL;
import com.vaadin.terminal.gwt.client.Util;
-import com.vaadin.terminal.gwt.client.ValueMap;
import com.vaadin.terminal.gwt.client.ui.dd.VAbstractDropHandler;
import com.vaadin.terminal.gwt.client.ui.dd.VAcceptCallback;
import com.vaadin.terminal.gwt.client.ui.dd.VDragAndDropManager;
@@ -33,7 +32,6 @@ import com.vaadin.terminal.gwt.client.ui.dd.VDragEvent;
import com.vaadin.terminal.gwt.client.ui.dd.VDropHandler;
import com.vaadin.terminal.gwt.client.ui.dd.VHasDropHandler;
import com.vaadin.terminal.gwt.client.ui.dd.VTransferable;
-import com.vaadin.terminal.gwt.client.ui.dd.VDragAndDropManager.DragEventType;
/**
*
@@ -214,6 +212,7 @@ public class VTree extends FlowPanel implements Paintable, VHasDropHandler {
@Override
protected void dragAccepted(final VDragEvent drag) {
+
}
@Override
@@ -234,32 +233,15 @@ public class VTree extends FlowPanel implements Paintable, VHasDropHandler {
ApplicationConnection.getConsole().log(
"Change in Transferable " + currentMouseOverKey
+ " " + detail);
- VAcceptCallback accpectedCb = new VAcceptCallback() {
- public void handleResponse(ValueMap responseData) {
- if (responseData == null // via client
- // side
- // validation
- || responseData.containsKey("accepted")) {
- keyToNode.get(currentMouseOverKey)
- .emphasis(detail);
- }
- }
- };
- if (validateOnServer()) {
- VDragAndDropManager.get().visitServer(
- DragEventType.OVER, accpectedCb);
-
- } else {
- if (validates(currentDrag)) {
- accpectedCb.handleResponse(null);
- } else {
+ validate(new VAcceptCallback() {
+ public void accepted() {
keyToNode.get(currentMouseOverKey).emphasis(
- null);
- }
- if (oldIdOver != null
- && oldIdOver != currentMouseOverKey) {
- keyToNode.get(oldIdOver).emphasis(null);
+ detail);
}
+ }, currentDrag);
+ if (oldIdOver != null
+ && oldIdOver != currentMouseOverKey) {
+ keyToNode.get(oldIdOver).emphasis(null);
}
}
@@ -451,7 +433,7 @@ public class VTree extends FlowPanel implements Paintable, VHasDropHandler {
// start actual drag on slight move when mouse is down
VTransferable t = new VTransferable();
t.setComponent(VTree.this);
- t.setItemId(key);
+ t.setData("itemId", key);
VDragEvent drag = VDragAndDropManager.get().startDrag(
t, mouseDownEvent, true);
diff --git a/src/com/vaadin/terminal/gwt/client/ui/dd/VAbstractDropHandler.java b/src/com/vaadin/terminal/gwt/client/ui/dd/VAbstractDropHandler.java
index 42602dd3be..2fe69101d8 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/dd/VAbstractDropHandler.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/dd/VAbstractDropHandler.java
@@ -1,33 +1,36 @@
package com.vaadin.terminal.gwt.client.ui.dd;
+import com.vaadin.event.AbstractDropHandler;
+import com.vaadin.event.DropTarget;
+import com.vaadin.event.Transferable;
+import com.vaadin.event.AbstractDropHandler.AcceptCriterion;
import com.vaadin.terminal.gwt.client.Paintable;
import com.vaadin.terminal.gwt.client.UIDL;
-import com.vaadin.terminal.gwt.client.ValueMap;
-import com.vaadin.terminal.gwt.client.ui.dd.VDragAndDropManager.DragEventType;
public abstract class VAbstractDropHandler implements VDropHandler {
- private boolean serverValidate;
+ private boolean mustValidateOnServer = true;
private UIDL criterioUIDL;
+ /**
+ * Implementor/user of {@link VAbstractDropHandler} must pass the UIDL
+ * painted by {@link AbstractDropHandler} (the server side counterpart) to
+ * this method. Practically the details about {@link AcceptCriterion} are
+ * saved.
+ *
+ * @param uidl
+ */
public void updateRules(UIDL uidl) {
- serverValidate = uidl.getBooleanAttribute("serverValidate");
+ mustValidateOnServer = uidl.getBooleanAttribute("serverValidate");
int childCount = uidl.getChildCount();
for (int i = 0; i < childCount; i++) {
UIDL childUIDL = uidl.getChildUIDL(i);
if (childUIDL.getTag().equals("acceptCriterion")) {
criterioUIDL = childUIDL;
- // TODO consider parsing the criteria tree here instead of
- // translating uidl during validates()
-
}
}
}
- public boolean validateOnServer() {
- return serverValidate;
- }
-
/**
* Default implementation does nothing.
*/
@@ -36,42 +39,61 @@ public abstract class VAbstractDropHandler implements VDropHandler {
}
/**
- * Default implementation does nothing.
+ * Default implementation does nothing. Implementors should clean possible
+ * emphasis or drag icons here.
*/
public void dragLeave(VDragEvent drag) {
- // TODO Auto-generated method stub
}
/**
+ * The default implementation in {@link VAbstractDropHandler} checks if the
+ * Transferable is accepted.
+ * <p>
* If transferable is accepted (either via server visit or client side
- * rules) the default implementation calls {@link #dragAccepted(VDragEvent)}
- * method.
+ * rules) the default implementation calls abstract
+ * {@link #dragAccepted(VDragEvent)} method.
+ * <p>
+ * If drop handler has distinct places where some parts may accept the
+ * {@link Transferable} and others don't, one should use similar validation
+ * logic in dragOver method and replace this method with empty
+ * implementation.
+ *
*/
public void dragEnter(final VDragEvent drag) {
- if (serverValidate) {
- VDragAndDropManager.get().visitServer(DragEventType.ENTER,
- new VAcceptCallback() {
- public void handleResponse(ValueMap responseData) {
- if (responseData.containsKey("accepted")) {
- dragAccepted(drag);
- }
- }
- });
- } else if (validates(drag)) {
- dragAccepted(drag);
- }
+ validate(new VAcceptCallback() {
+ public void accepted() {
+ dragAccepted(drag);
+ }
+ }, drag);
}
+ /**
+ * This method is called when a valid drop location was found with
+ * {@link AcceptCriterion} either via client or server side check.
+ * <p>
+ * Implementations can set some hints for users here to highlight that the
+ * drag is on a valid drop location.
+ *
+ * @param drag
+ */
abstract protected void dragAccepted(VDragEvent drag);
+ protected void validate(VAcceptCallback cb, VDragEvent event) {
+ if (mustValidateOnServer) {
+ VDragAndDropManager.get().visitServer(cb);
+ } else if (validateOnClient(event)) {
+ cb.accepted();
+ }
+ }
+
/**
* Returns true if client side rules are met.
*
* @param drag
* @return
*/
- protected boolean validates(VDragEvent drag) {
+ protected boolean validateOnClient(VDragEvent drag) {
if (criterioUIDL != null) {
String criteriaName = criterioUIDL.getStringAttribute("name");
VAcceptCriteria acceptCriteria = VAcceptCriterion.get(criteriaName);
@@ -84,14 +106,24 @@ public abstract class VAbstractDropHandler implements VDropHandler {
return false;
}
+ /**
+ * The default implemmentation visits server if {@link AcceptCriterion}
+ * can't be verified on client or if {@link AcceptCriterion} are met on
+ * client.
+ */
public boolean drop(VDragEvent drag) {
- if (serverValidate) {
+ if (mustValidateOnServer) {
return true;
} else {
- return validates(drag);
+ return validateOnClient(drag);
}
}
+ /**
+ * Returns the Paintable who owns this {@link VAbstractDropHandler}. Server
+ * side counterpart of the Paintable is expected to implement
+ * {@link DropTarget} interface.
+ */
public abstract Paintable getPaintable();
}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/dd/VAcceptCallback.java b/src/com/vaadin/terminal/gwt/client/ui/dd/VAcceptCallback.java
index 2366105853..6c47604ea4 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/dd/VAcceptCallback.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/dd/VAcceptCallback.java
@@ -1,19 +1,15 @@
package com.vaadin.terminal.gwt.client.ui.dd;
-import com.vaadin.terminal.gwt.client.ValueMap;
public interface VAcceptCallback {
/**
* This method is called by {@link VDragAndDropManager} if the
* {@link VDragEvent} is still active. Developer can update for example drag
- * icon or target emphasis based on the information returned from server
- * side. If the drag and drop operation ends or the
- * {@link VAbstractDropHandler} has changed before response arrives, the
- * method is never called.
- *
- * @param responseData
+ * icon or empahsis the target if the target accepts the transferable. If
+ * the drag and drop operation ends or the {@link VAbstractDropHandler} has
+ * changed before response arrives, the method is never called.
*/
- public void handleResponse(ValueMap responseData);
+ public void accepted();
}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/dd/VAcceptCriterion.java b/src/com/vaadin/terminal/gwt/client/ui/dd/VAcceptCriterion.java
index f1b6d2de34..fe251df4e9 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/dd/VAcceptCriterion.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/dd/VAcceptCriterion.java
@@ -5,6 +5,9 @@ import java.util.Map;
import com.google.gwt.core.client.GWT;
+/**
+ * A class via all AcceptCriteria instances are fetched by an identifier.
+ */
public class VAcceptCriterion {
protected static Map<String, VAcceptCriteria> criterion = new HashMap<String, VAcceptCriteria>();
private static VAcceptCriterionImpl impl;
diff --git a/src/com/vaadin/terminal/gwt/client/ui/dd/VAcceptCriterionImpl.java b/src/com/vaadin/terminal/gwt/client/ui/dd/VAcceptCriterionImpl.java
index e2cd4b6a5b..7f93dfa149 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/dd/VAcceptCriterionImpl.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/dd/VAcceptCriterionImpl.java
@@ -62,14 +62,14 @@ public class VAcceptCriterionImpl {
private final class HasItemId implements VAcceptCriteria {
public boolean accept(VDragEvent drag, UIDL configuration) {
- return drag.getTransferable().getItemId() != null;
+ return drag.getTransferable().getData("itemId") != null;
}
}
/**
- * TODO this method could be written by generator
+ * TODO this class/method must be written by generator
*
- * TODO consider moving implementations to top level classes
+ * TODO move implementations to top level classes.
*
* TODO use fully qualified names of server side counterparts as keys
*/
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 4a302b3f4d..6382147634 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/dd/VDragAndDropManager.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/dd/VDragAndDropManager.java
@@ -228,6 +228,12 @@ public class VDragAndDropManager {
private NativePreviewHandler defaultDragAndDropEventHandler = new DefaultDragAndDropEventHandler();
/**
+ * Flag to indicate if drag operation has really started or not. Null check
+ * of currentDrag field is not enough as a lazy start may be pending.
+ */
+ private boolean isStarted;
+
+ /**
* This method is used to start Vaadin client side drag and drop operation.
* Operation may be started by virtually any Widget.
* <p>
@@ -251,6 +257,7 @@ public class VDragAndDropManager {
public VDragEvent startDrag(VTransferable transferable,
final NativeEvent startEvent, final boolean handleDragEvents) {
interruptDrag();
+ isStarted = false;
currentDrag = new VDragEvent(transferable, startEvent);
updateCurrentEvent(startEvent);
@@ -258,6 +265,7 @@ public class VDragAndDropManager {
final Command startDrag = new Command() {
public void execute() {
+ isStarted = true;
VDropHandler dh = null;
if (startEvent != null) {
dh = findDragTarget((Element) currentDrag.currentGwtEvent
@@ -273,84 +281,86 @@ public class VDragAndDropManager {
if (handleDragEvents) {
handlerRegistration = Event
.addNativePreviewHandler(defaultDragAndDropEventHandler);
+ if (dragElement != null
+ && dragElement.getParentElement() == null) {
+ // deferred attaching drag image is on going, we can
+ // hurry with it now
+ lazyAttachDragElement.cancel();
+ lazyAttachDragElement.run();
+ }
}
}
};
- if (handleDragEvents) {
+ if (handleDragEvents
+ && Event.as(startEvent).getTypeInt() == Event.ONMOUSEDOWN) {
// only really start drag event on mousemove
- if (Event.as(startEvent).getTypeInt() == Event.ONMOUSEDOWN) {
-
- deferredStartRegistration = Event
- .addNativePreviewHandler(new NativePreviewHandler() {
-
- public void onPreviewNativeEvent(
- NativePreviewEvent event) {
- int typeInt = event.getTypeInt();
- switch (typeInt) {
- case Event.ONMOUSEOVER:
- if (dragElement == null
- || !dragElement
- .isOrHasChild((Node) event
- .getNativeEvent()
- .getCurrentEventTarget()
- .cast())) {
- // drag image appeared below, ignore
- ApplicationConnection.getConsole().log(
- "Drag image appeared");
- break;
- }
- case Event.ONKEYDOWN:
- case Event.ONKEYPRESS:
- case Event.ONKEYUP:
- case Event.ONBLUR:
- // don't cancel possible drag start
- break;
- case Event.ONMOUSEOUT:
-
- if (dragElement == null
- || !dragElement
- .isOrHasChild((Node) event
- .getNativeEvent()
- .getRelatedEventTarget()
- .cast())) {
- // drag image appeared below, ignore
- ApplicationConnection.getConsole().log(
- "Drag image appeared");
- break;
- }
- case Event.ONMOUSEMOVE:
- deferredStartRegistration.removeHandler();
- deferredStartRegistration = null;
- updateCurrentEvent(event.getNativeEvent());
- startDrag.execute();
+ deferredStartRegistration = Event
+ .addNativePreviewHandler(new NativePreviewHandler() {
+
+ public void onPreviewNativeEvent(
+ NativePreviewEvent event) {
+ int typeInt = event.getTypeInt();
+ switch (typeInt) {
+ case Event.ONMOUSEOVER:
+ if (dragElement == null
+ || !dragElement
+ .isOrHasChild((Node) event
+ .getNativeEvent()
+ .getCurrentEventTarget()
+ .cast())) {
+ // drag image appeared below, ignore
+ ApplicationConnection.getConsole().log(
+ "Drag image appeared");
break;
- default:
- // on any other events, clean up the
- // deferred drag start
+ }
+ case Event.ONKEYDOWN:
+ case Event.ONKEYPRESS:
+ case Event.ONKEYUP:
+ case Event.ONBLUR:
+ // don't cancel possible drag start
+ break;
+ case Event.ONMOUSEOUT:
+
+ if (dragElement == null
+ || !dragElement
+ .isOrHasChild((Node) event
+ .getNativeEvent()
+ .getRelatedEventTarget()
+ .cast())) {
+ // drag image appeared below, ignore
ApplicationConnection.getConsole().log(
- "Drag did not start due event"
- + event.getNativeEvent()
- .getType());
-
- deferredStartRegistration.removeHandler();
- deferredStartRegistration = null;
- currentDrag = null;
- if (dragElement != null) {
- RootPanel.getBodyElement().removeChild(
- dragElement);
- dragElement = null;
- }
+ "Drag image appeared");
break;
}
-
+ case Event.ONMOUSEMOVE:
+ deferredStartRegistration.removeHandler();
+ deferredStartRegistration = null;
+ updateCurrentEvent(event.getNativeEvent());
+ startDrag.execute();
+ break;
+ default:
+ // on any other events, clean up the
+ // deferred drag start
+ ApplicationConnection.getConsole().log(
+ "Drag did not start due event"
+ + event.getNativeEvent()
+ .getType());
+
+ deferredStartRegistration.removeHandler();
+ deferredStartRegistration = null;
+ currentDrag = null;
+ if (dragElement != null) {
+ RootPanel.getBodyElement().removeChild(
+ dragElement);
+ dragElement = null;
+ }
+ break;
}
- });
+ }
- } else {
- startDrag.execute();
- }
+ });
} else {
startDrag.execute();
@@ -454,7 +464,9 @@ public class VDragAndDropManager {
currentDrag = null;
if (dragElement != null) {
- RootPanel.getBodyElement().removeChild(dragElement);
+ if (dragElement.getParentElement() != null) {
+ RootPanel.getBodyElement().removeChild(dragElement);
+ }
dragElement = null;
}
}
@@ -472,8 +484,8 @@ public class VDragAndDropManager {
*
* @param acceptCallback
*/
- public void visitServer(DragEventType type, VAcceptCallback acceptCallback) {
- doRequest(type);
+ public void visitServer(VAcceptCallback acceptCallback) {
+ doRequest(DragEventType.ENTER);
this.acceptCallback = acceptCallback;
}
@@ -499,15 +511,6 @@ public class VDragAndDropManager {
VTransferable transferable = currentDrag.getTransferable();
- if (transferable.getItemId() != null) {
- client.updateVariable(DD_SERVICE, "itemId", transferable
- .getItemId(), false);
- }
- if (transferable.getPropertyId() != null) {
- client.updateVariable(DD_SERVICE, "propertyId", transferable
- .getPropertyId(), false);
- }
-
client.updateVariable(DD_SERVICE, "component", transferable
.getComponent(), false);
@@ -541,7 +544,9 @@ public class VDragAndDropManager {
}
int visitId = valueMap.getInt("visitId");
if (this.visitId == visitId) {
- acceptCallback.handleResponse(valueMap);
+ if (valueMap.containsKey("accepted")) {
+ acceptCallback.accepted();
+ }
acceptCallback = null;
}
}
@@ -560,13 +565,18 @@ public class VDragAndDropManager {
style.setZIndex(600000);
updateDragImagePosition();
- /*
- * To make our default dnd handler as compatible as possible, we
- * need to defer the appearance of dragElement. Otherwise events
- * that are derived from sequences of other events might not fire as
- * domchanged will fire between them.
- */
- lazyAttachDragElement.schedule(300);
+ if (isStarted) {
+ lazyAttachDragElement.run();
+ } else {
+ /*
+ * To make our default dnd handler as compatible as possible, we
+ * need to defer the appearance of dragElement. Otherwise events
+ * that are derived from sequences of other events might not
+ * fire as domchanged will fire between them or mouse up might
+ * happen on dragElement.
+ */
+ lazyAttachDragElement.schedule(300);
+ }
}
}
@@ -574,7 +584,7 @@ public class VDragAndDropManager {
@Override
public void run() {
- if (dragElement != null) {
+ if (dragElement != null && dragElement.getParentElement() == null) {
RootPanel.getBodyElement().appendChild(dragElement);
}
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 a35a4a7e0c..d75e4e0355 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/dd/VDragEvent.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/dd/VDragEvent.java
@@ -9,6 +9,7 @@ import com.google.gwt.dom.client.NativeEvent;
import com.google.gwt.dom.client.TableElement;
import com.google.gwt.dom.client.TableSectionElement;
import com.google.gwt.dom.client.Style.Unit;
+import com.google.gwt.event.dom.client.MouseOverEvent;
import com.google.gwt.user.client.Element;
import com.vaadin.terminal.gwt.client.BrowserInfo;
@@ -49,14 +50,26 @@ public class VDragEvent {
return transferable;
}
+ /**
+ * Returns the the latest {@link NativeEvent} that relates to this drag and
+ * drop operation. For example on {@link VDropHandler#dragEnter(VDragEvent)}
+ * this is commonly a {@link MouseOverEvent}.
+ *
+ * @return
+ */
public NativeEvent getCurrentGwtEvent() {
return currentGwtEvent;
}
- public int getEventId() {
+ int getEventId() {
return id;
}
+ /**
+ * @deprecated will be removed from final implementation, here just to aid
+ * development.
+ */
+ @Deprecated
public long sinceStart() {
return new Date().getTime() - start.getTime();
}
@@ -64,11 +77,11 @@ public class VDragEvent {
/**
* Detecting the element on which the the event is happening may be
* problematic during drag and drop operation. This is especially the case
- * if a drag image (often called drag proxy) is kept under the mouse cursor
- * (see {@link #createDragImage(Element, boolean)}. Drag and drop event
- * handlers (like the one provided by {@link VDragAndDropManager} ) should
- * set elmentOver field to reflect the the actual element on which the
- * pointer currently is (drag image excluded). {@link VDropHandler}s can
+ * if a drag image (often called also drag proxy) is kept under the mouse
+ * cursor (see {@link #createDragImage(Element, boolean)}. Drag and drop
+ * event handlers (like the one provided by {@link VDragAndDropManager} )
+ * should set elmentOver field to reflect the the actual element on which
+ * the pointer currently is (drag image excluded). {@link VDropHandler}s can
* then more easily react properly on drag events by reading the element via
* this method.
*
@@ -93,8 +106,8 @@ public class VDragEvent {
* TODO decide if this method should be here or in {@link VTransferable} (in
* HTML5 it is in DataTransfer) or {@link VDragAndDropManager}
*
- * TODO should be possible to override behaviour an set to HTML5
- * DataTransfer
+ * TODO should be possible to override behavior. Like to proxy the element
+ * to HTML5 DataTransfer
*
* @param node
*/
diff --git a/src/com/vaadin/terminal/gwt/client/ui/dd/VHtml5DragEvent.java b/src/com/vaadin/terminal/gwt/client/ui/dd/VHtml5DragEvent.java
index 6689fbe307..3aaff0b5e0 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/dd/VHtml5DragEvent.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/dd/VHtml5DragEvent.java
@@ -3,6 +3,10 @@ package com.vaadin.terminal.gwt.client.ui.dd;
import com.google.gwt.core.client.JsArrayString;
import com.google.gwt.dom.client.NativeEvent;
+/**
+ * Helper class to access html5 style drag events.
+ *
+ */
public class VHtml5DragEvent extends NativeEvent {
protected VHtml5DragEvent() {
}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/dd/VTransferable.java b/src/com/vaadin/terminal/gwt/client/ui/dd/VTransferable.java
index f04a4d8e33..2654f9a013 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/dd/VTransferable.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/dd/VTransferable.java
@@ -18,6 +18,9 @@ public class VTransferable {
private final Map<String, Object> variables = new HashMap<String, Object>();
/**
+ * Returns the component currently being dragged or from which the
+ * transferable is created (eg. a tree which node is dragged).
+ *
* @return the component
*/
public Paintable getComponent() {
@@ -25,6 +28,13 @@ public class VTransferable {
}
/**
+ * Sets the component currently being dragged or from which the transferable
+ * is created (eg. a tree which node is dragged).
+ * <p>
+ * The server side counterpart of the componennt may implement
+ * {@link DragSource} interface if it wants to translate or complement the
+ * server side instance of this Transferable.
+ *
* @param component
* the component to set
*/
@@ -32,51 +42,6 @@ public class VTransferable {
this.component = component;
}
- /**
- * This is commonly actually a key to property id on client side than the
- * actual propertyId.
- *
- * Translated by terminal and {@link DragSource}
- *
- * @return the propertyId
- */
- public String getPropertyId() {
- return (String) variables.get("propertyId");
- }
-
- /**
- * This is commonly actually a key to property id on client side than the
- * actual propertyId.
- *
- * Translated by terminal and {@link DragSource}
- *
- * @param propertyId
- * the propertyId to set
- */
- public void setPropertyId(String propertyId) {
- variables.put("propertyId", propertyId);
- }
-
- /**
- * @return the itemId
- */
- public String getItemId() {
- return (String) variables.get("itemId");
- }
-
- /**
- * This is commonly actually a key to item id on client side than the actual
- * itemId.
- *
- * Translated by terminal and {@link DragSource}
- *
- * @param itemId
- * the itemId to set
- */
- public void setItemId(String itemId) {
- variables.put("itemId", itemId);
- }
-
public Object getData(String dataFlawor) {
return variables.get(dataFlawor);
}
@@ -90,11 +55,11 @@ public class VTransferable {
}
/**
- * This method should only be called by {@link VDragAndDropManager}.
+ * This helper method should only be called by {@link VDragAndDropManager}.
*
* @return data in this Transferable that needs to be moved to server.
*/
- public Map<String, Object> getVariableMap() {
+ Map<String, Object> getVariableMap() {
return variables;
}