AuthorDnDListener - Can't get my objet
Posted: Wed Jun 13, 2012 12:08 pm
Hi,
In my application, I make a drag and drop action of a swing objet to an xml document, with a AuthorDnDListener which is in a framework and a java.awt.datatransfer.Transferable with a TransferHandler which are in a plugin.
That works !
But now I want to make some tests/update on the xml document during the DnD actions, and I don't want do that in the TransferHandler /exportDone() function. I want do all my test/update during the Dnd Action in the same place, most specially in the AuthorDnDListener/authorDrop function.
public boolean authorDrop(Transferable transferable, DropTargetDropEvent dropTargetDropEvent)
But in this function I can't cast the transferable to my transferableObjet, I don't understand why, and this one works in the TransferHandler /exportDone() function.
protected void exportDone(JComponent c, java.awt.datatransfer.Transferable transferable, int action)
Tool tool = (Tool) transferable.getTransferData(ToolTransferable.TOOL_DATAFLAVOR);
The exception message is :
Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: com._4dconcept.docAdvance.authorNeo.plugin.views.tools.SpareTool cannot be cast to com._4dconcept.docAdvance.authorNeo.plugin.views.tools.SpareTool
Do you have an idea ? or an example ?
Thanks in advance.
In my application, I make a drag and drop action of a swing objet to an xml document, with a AuthorDnDListener which is in a framework and a java.awt.datatransfer.Transferable with a TransferHandler which are in a plugin.
That works !
But now I want to make some tests/update on the xml document during the DnD actions, and I don't want do that in the TransferHandler /exportDone() function. I want do all my test/update during the Dnd Action in the same place, most specially in the AuthorDnDListener/authorDrop function.
public boolean authorDrop(Transferable transferable, DropTargetDropEvent dropTargetDropEvent)
But in this function I can't cast the transferable to my transferableObjet, I don't understand why, and this one works in the TransferHandler /exportDone() function.
protected void exportDone(JComponent c, java.awt.datatransfer.Transferable transferable, int action)
Tool tool = (Tool) transferable.getTransferData(ToolTransferable.TOOL_DATAFLAVOR);
The exception message is :
Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: com._4dconcept.docAdvance.authorNeo.plugin.views.tools.SpareTool cannot be cast to com._4dconcept.docAdvance.authorNeo.plugin.views.tools.SpareTool
Do you have an idea ? or an example ?
Thanks in advance.