Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8091244

DnD: support promised files




      This issue covers the quantum/glass part of RT-14732. To support dragging files from remote sources we need to transfer the files (possibly asynchronously) in the time of drop (currently we have to download the file when the drag is starting, which is unusable and blocks things like DnD support in FTP clients).

      All major operating systems support it although in quite distinct ways. I have a vague idea how the API could look like, but it will require a joint effort of glass and scenegraph teams to design and implement a solution working everywhere, so please let me know if you include this issue in your plans so that I can synchronize my plans.

      Similar issue is open for almost ten years on Swing (and has over sixty votes): http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4808793
      They made some progress and an excellent summary of the native support by Damjan Jovanovic can be found there (among other valuable resources) - I'm pasting it here for a quick start:

      Windows has the CFSTR_FILEDESCRIPTOR/CFSTR_FILECONTENTS formats for this. Basically files are presented using their contents, in the form of IStream, IStorage or HGLOBAL, with additional data describing the file name and properties (http://msdn.microsoft.com/en-us/library/bb776902(VS.85).aspx).

      OS X has "promise data flavors" (http://developer.apple.com/documentation/Carbon/Reference/Pasteboard_Reference/Reference/reference.html). The drag source supplies a promise instead of data, and a callback that's invoked to supply the data. When the callback is called, it can get a URL where the files should be saved.

      X11 has the X direct save protocol (http://www.freedesktop.org/wiki/Specifications/XDS), which seems to be a mixture of the Windows and OS X ways. The emphasis in the protocol is on saving a file, rather than transferring a list of files. First the drop target gives the drag source a URL where to save the file(s), just like OS X would. If the drag source cannot access that URL or doesn't have permission, it reports this to the drop target, and the drop target then falls back to requesting the file contents as application/octet-stream - similar to the Windows way, but it only works for one file.


          Issue Links



              Unassigned Unassigned
              psafrata Pavel Ĺ afrata
              2 Vote for this issue
              8 Start watching this issue