JDK-6342398 : More flexibility in specifying drag over changes to a component
  • Type: Enhancement
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 5.0
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: solaris_9
  • CPU: sparc
  • Submitted: 2005-10-27
  • Updated: 2010-04-02
  • Resolved: 2005-10-27
Related Reports
Duplicate :  
Relates :  
Description
A DESCRIPTION OF THE REQUEST :
The BasicDragGestureRecognizer and BasicDropTargetListener classes are package private, as well as their child classes in swing components.  They cannot, therefore, be overridden to allow the developer to specify their own functionality for how these components will display where a drop will occur to the user.

JUSTIFICATION :
Allowing how to display back drag effects to the user is not always static, and there needs to be more support for how drag operations appear to the user.  It is convenient that, now, that a developer can code what kind of datas can be dropped into a component via the TransferHandler.  For usability purposes, though, it shouldn't be assumed that this will always be displayed back to the user in the manner set forth in the current implementation.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
It would be nice to have these classes (BasicDragGestureRecognizer and BasicDropTargetListener) made public, and maybe even the extedning inner classes to various components, but it would be even cooler if different options were available for how to display the drop back to  the user.  For example, for the JTree, if it could display a line to show that a drop will occur in between two nodes, and highlight a node to display that the drop will occur on the node (which is all that happens, now). Further research into this for various components (such as modifiers effect on operations) and different behaviors that could be set would probably be needed (as I"m not a usability expert and don't know exactly what should be available).

CUSTOMER SUBMITTED WORKAROUND :
Mimic the behavior of the BasicDropTargetListener and add your own implementation to the component.getDropTarget().addDropTargetListener(), though this requires preventing the current listener from being added, somehow.

Comments
EVALUATION The submitter should be pleased to know that in Mustang we did major enhancements to Swing's DnD support. As part of this we removed BasicDropTargetListener and BasicDragGestureRecognizer. BasicDragGestureRecognizer was replaced with code in the UIs that detect drags much better than previously. This was for bug 4521075. BasicDropTargetListener was replaced with code that provides much more flexibility in how the drop location is indicated. Please refer to 4468566 for full details. In essence, we now provide multiple drop modes for list/table/tree/text, including the ability to drop between items, as the submitter mentioned for JTree. We also send out notification of drop location changes so that UIs can customize the visual representation.
27-10-2005