<AWT Dev> 4899516: Transferable has no DataFlavors when dragging from Gnome window to Swing

Damjan Jovanovic damjan.jov at gmail.com
Fri Sep 28 06:58:48 PDT 2007


On 9/27/07, Denis S. Fokin <Denis.Fokin at sun.com> wrote:
> Hi Damjan,
>
> personally, I like the idea to implement a set of predefined DataFlavours. In particular to provide predefined DataFlavor represented a List of URI is very good idea.
>
> But I do not like idea to modify the handling of DataFlavor.javaFileListFlavor flavor.
>
> There are two issues bothering me.
>
> 1. list of Files could be empty.

The same problem exists in (at least) SWT and wine. It can be argued
that a zero size list is still a list, and applications shouldn't make
assumptions about the number of files.

> 2. the question how to convert URI in File is open. How we should interpret "ftp:///" protocol in this case? Would be our new interpretation compatible with existing applications and so on.

If it's a file:// URI then pass it in a constructor to File, otherwise
(eg. ftp://) ignore it.

> Another solution which I see is to keep the current handling of DataFlavor.javaFileListFlavor flavor unchangeable. But mark it as deprecated. Like it is done whith the DataFlavor.plainTextFlavor. And suggest to use the new URI list data flavor instead of the deprecated one.

That way there is 10 years worth of Java applications that have to be updated.

> The new data flavor will contain list of URI and will cover all protocols. On Windows all returned URI will be URI of files.
>
> In that case, another question that should be answered is if we will convert native uri-list mime type at the same time in DataFlavor.javaFileListFlavor and a list of URI, should we do the same conversation when transfer is local or intra-jvm? In case of transfer between two java applications, user could provide only URI list flavor. Should we provide DataFlavor.javaFileListFlavor to target as well in that case?

Presumably in intra-VM transfers we don't do any conversion, because
the app knows what it's doing to itself.

> So the second solution has it's own issues but looks much more appropriate for me.

I agree that adding a URIList flavor is the best way. But it's 2007
now, why must Java applications still not work properly with file
drops on Linux and continue to do so until people change their code?
And since most applications don't support non-file URIs anyway, the
most likely thing people will do is loop over each URI and ignore it
if it isn't a local file. Adding URIList flavor is the way forward,
but at the same time, why not get javaFileListFlavor working too (even
if it is deprecated) for the apps that don't support URIList flavor?

> Thank you,
>       Denis.

Thank you
Damjan



More information about the awt-dev mailing list