JDK-4938575 : DropTargetListener cannot get dragged Transferable
  • Type: Enhancement
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 1.4.2
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2003-10-16
  • Updated: 2003-10-17
  • Resolved: 2003-10-17
Related Reports
Duplicate :  
Relates :  
Description

Name: rmT116609			Date: 10/15/2003


A DESCRIPTION OF THE REQUEST :
No way for a Java application/applet to get the Transferable as a TargetListener, but it is almost possible with the DropTargetContext:
 DropTargetDragEvent.getDropTargetContext().getTransferable(), but the access is protected, whereas the 'symmetrical' DragSourceContext.getTransferable() is public...incredible!

JUSTIFICATION :
The problem is when the program needs data from the Transferable in order to 'know' whether the drop would be possible or not, and/or, in order to present data from the Transferable before the drop (the user would have a preview of what the drop would do).

Anyway, why putting such limitations as the DropTargetContext knows the TransferableProxy (which knows the Transferable istelf)?

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
DropTargetContext.getTransferable() declared as public
ACTUAL -
DropTargetContext.getTransferable() is declared protected and there is no 'clean' way to bypass that as DropTargetContext has no public constructor (it is not possible to construct an extended context which would add the behavior)

---------- BEGIN SOURCE ----------
Change in the java.awt.dnd.DropTargetContext:

public Transferable getTransferable() { ... }
---------- END SOURCE ----------
(Incident Review ID: 185307) 
======================================================================

Comments
EVALUATION Name: dsR10078 Date: 10/16/2003 The same functionality is requested in 4248542 and 4378091. The respective public API was integrated in Tiger. ###@###.### 2003-10-17 ======================================================================
17-10-2003