Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Drag n drop remote files to local system

Status
Not open for further replies.

mem21

Programmer
Jan 13, 2005
2
US
I have an applet that lists the files contained on a remote server's database. I am able to drag and drop the files, but when getTransferData() is called the applet has to start downloading the files to a temp location to supply the File[]. Windows Explorer and other applications ask for the data when the drag first enters their drop region. Both applications block during the getTransferData call until all files are downloaded, which could be hundreds of files and up to 500 MB. This results in a lot of wasted bandwidth and time if the drop was cancelled.

Is there any way to pass an InputStream[] instead of a File[]? Is there a way to have this happen outside of the GUI thread?
 
sure, just create an object that implemets thread and make sure to read up on synchronization. I'm afraid (however) that the program would then also need two ports instead of one...

Communication and control of the applet in general and then the other for file transfers.
 
jstreich,

I realized that I was not clear enough in my description of the problem, or I do not fully understand your answer. I am dragging from an applet and dropping to an "unknown" application that is running on the local operating system. E.g. Windows Explorer, or some other non java application that accepts a file drop. The applet already has a threaded "task" manager to keep other aspects of the GUI running smooth. I haven't added the drag and drop downloads in to this framework because it would block the target application. My question was intended to be more about finding a way of preventing the files from being downloaded before the drop actually happens.
 
Ah! That is a completly different question than the one I thought you were asking... and unfortunatly, I don't know the answer off hand.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top