AWT Data Transfer

Pre-reading

Please refer to http://java.sun.com/j2se/1.5.0/docs/api/java/awt/datatransfer/package-summary.html for general information on AWT data transfer. See the drag-and-drop specification and tutorial at http://java.sun.com/j2se/1.5.0/docs/guide/dragndrop/index.html.

Data Flavors

The mapping between the Java type and content type is the SystemFlavorMap. The mapping between content type and native format is hard-coded as long as each native format needs some code to perform the conversion. Harmony implementation does the data conversion is performed in two steps: from Java to intermediate format (which is platform-independent, and is one of content types listed above), then from intermediate format to the platform-dependent native format. The conversion from native format to Java is performed also in two steps: from native to intermediate, then from intermediate to Java.

The table below shows the mapping of data flavors to supported native Windows formats.

Java type

Content type

Native format on Windows

String char[] InputStream

text/plain

CF_TEXT CF_UNICODETEXT

Image, BufferedImage

image/x-java-image

CF_DIB (device independent bitmap) CF_ENHMETAFILE

java.net.URL

application/x-java-url

CFSTR_INETURLW CFSTR_INETURLA

String char[] InputStream

text/html

"HTML Format"

java.util.List

application/x-java-file-list

CF_HDROP

java.lang.Serializable

application/x-java-serialized-object

org.apache.harmony.awt.datatransfer: application/x-java-serialized-object; class=

Data structure

The picture below illustrates the structure of the intermediate data.

data.png

Diagram legend:

Drag-and-drop subsystem

The diagram below shows the relationship between public API and implementation classes. The classes that have “Win” prefix are for Windows platform, on other platforms there should be similar platform-specific classes.

classes.png

Event handling and threads

The following figure gives an overview of the message routing and thread interaction in Harmony implementation on Windows.

events.png

The things which are missing and/or wanted

Cross-platform

Windows

Linux (X11)

Support system selection

Selections are

Support drag-and-drop (Xdnd)

Implement data conversion from/to native formats

Please refer to http://www.freedesktop.org/wiki/Standards for X11-related standards and specifications.

DnD Development Plan

AWT/Windows (6w)

Swing/Windows (6w)

Drag_and_Drop (last edited 2009-09-20 21:55:16 by localhost)