aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes getTransferdata() not working as expected in drag drop from jtable to jtree Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "getTransferdata() not working as expected in drag drop from jtable to jtree" Watch "getTransferdata() not working as expected in drag drop from jtable to jtree" New topic
Author

getTransferdata() not working as expected in drag drop from jtable to jtree

Shabana Patel
Greenhorn

Joined: Dec 06, 2012
Posts: 1

Hi
I am trying to drag multiple rows (discontinuous ) from a jtable to a jtree. I am using a customized transferable object and a customized transferhandler. However,I lose my objects within the import data method, as it gets lost inside the java method getTransferData(DataFlavor df) within class DropTargetContext.java. The code is as follows:




The class cObject is serializable. The customized transfer handler is declared as an inner class within the panel that contains both tree and table.



The transferable object t has the objects in array list correctly but when I call t.getTransferData, the array list comes back the null objects. E.g. if three rows were chosen from the table, This calls getTransferData method in cObjectList which returns these objects in the arraylist correctly but when it reaches getTransferData in DropTargetContext.java the values nside the array list return as null even thought the list/ object itself still shows size =3.

The drop mode selected for the tree is:
treeObjectStructure.setTransferHandler(new ObjectTreeTransferHandler());
treeObjectStructure.setDropMode(DropMode.ON_OR_INSERT);
Can anyone help me figure out what I have done wrong? I posted this question on stack overflow as well but did not receive any good suggestions, so now I'm asking here.
link:
http://stackoverflow.com/questions/13730660/gettransferdata-in-transferhandler-not-working-as-expected-for-multiple-droppi


Kemal Sokolovic
Bartender

Joined: Jun 19, 2010
Posts: 825
    
    5

Please BeForthrightWhenCrossPostingToOtherSites (link).

Welcome to Ranch!


The quieter you are, the more you are able to hear.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: getTransferdata() not working as expected in drag drop from jtable to jtree