My massive hack for native drag-and-drop in jSeamless Flex implementation is functional, but only in Firefox. Apparently there is an interesting “feature” in IE that even though you may sign your Applet and the user grants that they way to trust said Applet, it still never gives you read access to the file system.
That being said, here is my outlined approach for another hack that avoids the use of an Applet in favor of Java Web Start. I know Java Web Start can do what I want to do, but to my knowledge there is no way to communicate directly between the client-side web site and the JWS instance.
- Load the JWS application that stays hidden
- Load the Flex content page
- Server sends event back to JWS (either socket or delayed Ajax necessary for both JWS and Flex)
- JWS application triggers the single-pixel-at-mouse-position-window that is listening for dragging
- If JWS doesn’t receive a drag enter event it goes back to sleep and hides our friendly, yet scary, window
- If JWS receives a window exit event it goes back to sleep.
- If JWS receives the drop event a new event is sent down to the server with the list of files dropped.
- Server sends an event to Flex requesting the current component the mouse is over and temporarily stores the list of files dropped via a request id.
- Flex determines the current component the mouse is over and sends an event back to the server with that id.
- Server triggers internal jSeamless event for file dnd with the list of files and the component id (if the component accepts the drop).
- Upon server-side accept of a file an event is sent to JWS to stream the file
- JWS receives file stream request and streams the file to the server.
How’s that for evil? I thought the original hack was bad, but this is just downright insane. However, it would seem this is the only plausible way to get native drag and drop support.