<AWT Dev> 4899516: Transferable has no DataFlavors when dragging from Gnome window to Swing
Denis S. Fokin
Denis.Fokin at Sun.COM
Tue Sep 25 07:42:52 PDT 2007
Currently, in the AWT implementation there is no data flavor like
DataFlavor.javaFileListFlavor for uri-list mime-type.
What is more a change request exists related to the issue.
CR "4899516 Transferable has no DataFlavors when dragging from Gnome
window to Swing"
You can find in the workaround section how to create a custom
Transferable to transfer the uri-list mime-type data.
So I cannot agree that AWT "has zero support for the X file drag
But the question about a better support is disputable.
There are number of ways how to solve the task to implement DnD between
java application and GNOME nautilus.
The first one is to implement some kind of analysis in AWT code. In that
case we could introduce a new default DataFlavor like
return from Transferable.getTransferData() a list of URIs. Note, that we
cannot be sure, that provided by Gnome data contains files, so we cannot
The second way is to implement some TransferHandler in Swing library.
The third way is to give programmer a possibility to decide how to
handle the uri-list.
I do not see a problem with the third variant.
Could you describe in more details in what way do you see better support
of X file drag specification?
Damjan Jovanovic wrote:
> >From what I can tell, Java has superb support for the XDND protocol,
> yet it has zero support for the X file drag specification
> (http://www.newplanetsoftware.com/xdnd/dragging_files.html) which is
> part of that protocol. This means file drops to Java apps do not work
> as expected on any freedesktop environment (at least Gnome, very
> likely KDE and XFCE as well).
> I've already written an X file drag implementation for wine
> (http://www.winehq.org/pipermail/wine-cvs/2007-June/033705.html) and I
> think it's about time Java started working too.
> If nobody has any objections and nobody is already working on it, I'd
> like to have a go at fixing this.
> Since text/uri-list is more general than a file list, would the right
> approach be dropping non-file URIs?
> Thank you
> Damjan Jovanovic
More information about the awt-dev