JDK-8101024 : Drag and drop needs support for drag view
  • Type: Enhancement
  • Component: javafx
  • Sub-Component: scenegraph
  • Affected Version: 8
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2011-07-01
  • Updated: 2015-06-16
  • Resolved: 2013-02-05
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 8
8Fixed
Related Reports
Blocks :  
Blocks :  
Duplicate :  
Duplicate :  
Relates :  
Description
Common feature of drag and drop is an image representing the data floating with the cursor during drag and drop operation. In FX this is called "Drag View" and is likely to be added to Dragboard. 

The API proposal:

Add methods to DragBoard:
void setDragView(Image image, double offsetX, double offsetY) // convenience method for the three calls
void setDragView(Image image) // typically used with event.getGestureSource().snapshot()
void setDragViewOffsetX(double offsetX)
void setDragViewOffsetY(double offsetY)
Image getDragView()
double getDragViewOffsetX()
double getDragViewOffsetY()

All those methods are to be used only during drag detection (in a DRAG_DETECTED event handler) and will have no effect or return nulls and zeros if called elsewhere.

Comments
Unit Tests: javafx/scene/input/DragAndDropTest/startDragShouldNotBeCalledIfNothingPutOnDragboardWithDragView javafx/scene/input/DragAndDropTest/startDragShouldBeCalledIfStringPutOnDragboardsWithDragView javafx/scene/input/DragAndDropTest/changeDragViewInParentHandlerShouldBePossible javafx/scene/input/DragAndDropTest/settingDragViewAndCursorPositionShouldReturnSameResults javafx/scene/input/DragAndDropTest/dragViewShouldBeClearedInSubsequentDragDetectedCall (These test the scenegraph part of the code, not the underlying implementation in Quantum as it cannot be tested in juint)
03-04-2013

Is it covered with any junit tests? I cannot recognise, do I need to do extensive test of getters and setters, or not.
02-04-2013

http://jfxsrc.us.oracle.com/javafx/8.0/scrum/graphics/rt/rev/2a0b0d0d4dd1 http://jfxsrc.us.oracle.com/javafx/8.0/scrum/graphics/rt-closed/rev/5322072b9635
05-02-2013

We had powerful tool DnDView that was specially design for that. It covers DnD and Clipboard viewer functionality. The Mozilla bug https://bugzilla.mozilla.org/show_bug.cgi?id=757478 Disclose the old version of tool (look in attachment).
15-01-2013

A user posted a workaround for this missing feature here: http://stackoverflow.com/questions/13624491/implement-drag-and-drop-like-in-scene-builder
30-11-2012

I'm in need of this feature as well. If I put an Image on the clipboard, I would expect the drag icon to be that same Image.
24-11-2012

The Graphics part has been separated to RT-21978, removing Graphics component.
01-06-2012