Package com.google.gwt.dom.client

## Class DataTransfer

- java.lang.Object
- - com.google.gwt.core.client.JavaScriptObject
  - - com.google.gwt.dom.client.DataTransfer

-     public class DataTransfer
      extends JavaScriptObject

  Class representing DataTransfer interface.

  Experimental API: This API is still under development and is subject to change.

  See Also:
    W3C HTML Specification

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class | Description
    --- | --- | ---
    `static class` | `DataTransfer.DropEffect` | Used to specify the drop effect to use on dragenter or dragover events.

  - ### Constructor Summary

    Constructors
    Modifier | Constructor | Description
    --- | --- | ---
    `protected` | `DataTransfer()` | Required constructor for GWT compiler to function.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `clearData()` | Remove all data from the current drag sequence.
    `void` | `clearData​(java.lang.String format)` | Remove the data for the specified format for all drag events in the current drag sequence.
    `java.lang.String` | `getData​(java.lang.String format)` | Get the data for the specified format.
    `void` | `setData​(java.lang.String format, java.lang.String data)` | Set the data for the specified format to associate with all drag events in the current drag and drop sequence.
    `void` | `setDragImage​(Element element, int x, int y)` | Specify the element to use to update the drag feedback.
    `void` | `setDropEffect​(DataTransfer.DropEffect dropEffect)` | Specify the drop effect to use on dragenter or dragover events.

    - ### Methods inherited from class com.google.gwt.core.client.JavaScriptObject

      `cast, createArray, createArray, createFunction, createObject, equals, hashCode, toSource, toString`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### DataTransfer

          protected DataTransfer()

      Required constructor for GWT compiler to function.

  - ### Method Detail

    - #### clearData

          public final void clearData()

      Remove all data from the current drag sequence.
      See Also:
        W3C Specification

    - #### clearData

          public final void clearData​(java.lang.String format)

      Remove the data for the specified format for all drag events in the current drag sequence.
      Parameters:
        `format` - the format, which is usually the mime-type of the associated data
      See Also:
        `setData(String, String)`, W3C Specification

    - #### getData

          public final java.lang.String getData​(java.lang.String format)

      Get the data for the specified format. The data may have been set in a previous drag event that is part of the current drag sequence.
      Parameters:
        `format` - the format, which is usually the mime-type of the data
      Returns:
        the data for the specified format
      See Also:
        `setData(String, String)`, W3C Specification

    - #### setData

          public final void setData​(java.lang.String format,
                                    java.lang.String data)

      Set the data for the specified format to associate with all drag events in the current drag and drop sequence. The data can be read using `getData(String)` from any subsequent drag events in this sequence (such as the drop event).

      The format is usually the mime-type of the data, but can also be `text`.

      Parameters:
        `format` - the format, which is usually the mime-type of the data
        `data` - the data to associate with the format
      See Also:
        W3C Specification

    - #### setDragImage

          public final void setDragImage​(Element element,
                                         int x,
                                         int y)

      Specify the element to use to update the drag feedback.
      Parameters:
        `element` - the feedback image
        `x` - the x offset of the cursor
        `y` - the y offset of the cursor
      See Also:
        W3C Specification

    - #### setDropEffect

          public final void setDropEffect​(DataTransfer.DropEffect dropEffect)

      Specify the drop effect to use on dragenter or dragover events.
      Parameters:
        `dropEffect` - the drop effect to display.