From: Hiroo H. <hir...@co...> - 2004-09-22 02:31:09
|
Hi, Last night I checked in the various change for drag&drop (cut&paster, TransferHandler/Transferable) related code. The most important update is that now we can drag&drop Scene and can drag&drop Patch and Scene between a LibraryFrame and a SceneFrame. This has been a known bug for a long time. Hiroo> Jeff> I'm getting the following exception when I try to drag Hiroo> Jeff> a patch from a bank window to a library window. Can Hiroo> Jeff> anyone reproduce this? Hiroo> Hiroo> Hiroo> Yes, I can. I guess my bug fix made this bug. I'll take a look. I also made a fix for this, but I don't understand why the fix is necessary. For example if I drag&drop a Patch from a LibraryFrame to another LibraryFrame, you will see the following debug message if you run JSynthLib with debug option ('2'). DBG>PatchListTransferHandler.createTransferable [Roland TD6 Drumkit] f0 41 00 00 3f 12 41 62 00 00 41 63 75 53 74 69 .. 02 74 f7 DBG>Patch.isDataFlavorSupported java.awt.datatransfer.DataFlavor[mimetype=application/x-java-serialized-object;representationclass=[Lcore.IPatch;] DBG>Patch.getTransferData: flavor=java.awt.datatransfer.DataFlavor[mimetype=application/x-java-serialized-object;representationclass=[Lcore.IPatch;] DBG>Patch.getTransferData: Patch=[Roland TD6 Drumkit] f0 41 00 00 3f 12 41 62 00 00 41 63 75 53 74 69 .. 02 74 f7, MIDI-OX DBG>PatchTransferHandler.importData: t=java.awt.dnd.DropTargetContext$TransferableProxy@57828d DBG>PatchTransferHandler.importData: Patch=[null] f0 41 00 00 3f 12 41 62 00 00 41 63 75 53 74 69 .. 02 74 f7MIDI-OX This means that the Patch.driver field was set properly when Patch.getTransferData returns a patch. But when PatchTransferHandler.importData receives the data, the value of driver field becomes 'null'. Patch.driver field is private access now, and is set only by Patch.setDriver(IPatchDriver) method. When the argument Patch.setDriver() is null, setDriver method sets driver field Generic Driver. This means there is no way to set 'null' on Patch.driver field. Scene also has similar problem. driver field for a Patch in a Scene becomes 'null' when it is received by a importData method. For now I've fixed this bug by adding the following code. p.setDriver((IPatchDriver) DriverUtil.chooseDriver(p.getByteArray())); This is very strange. I don't understand why this line is required. If you have any clue, let me know. -- Hiroo Hayashi |