• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Greenhorn
Posts: 1
Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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


 
Bartender
Posts: 825
5
Python Ruby Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please BeForthrightWhenCrossPostingToOtherSites (link).

Welcome to Ranch!
 
reply
    Bookmark Topic Watch Topic
  • New Topic