Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.gui > #1872 > unrolled thread

Drag N Drop with virtual

Started by"Dirk Becker" <dirk.becker@THRWHITE.remove-dii-this>
First post2011-04-27 15:35 +0000
Last post2011-04-27 15:35 +0000
Articles 8 — 4 participants

Back to article view | Back to comp.lang.java.gui


Contents

  Drag N Drop with virtual "Dirk Becker" <dirk.becker@THRWHITE.remove-dii-this> - 2011-04-27 15:35 +0000
    Re: Drag N Drop with virt "bcr666" <bcr666@THRWHITE.remove-dii-this> - 2011-04-27 15:35 +0000
    Re: Drag N Drop with virt "Larry Barowski" <larry.barowski@THRWHITE.remove-dii-this> - 2011-04-27 15:35 +0000
      Re: Drag N Drop with virt "Larry Barowski" <larry.barowski@THRWHITE.remove-dii-this> - 2011-04-27 15:35 +0000
        Re: Drag N Drop with virt "dbhomers" <dbhomers@THRWHITE.remove-dii-this> - 2011-04-27 15:35 +0000
          Re: Drag N Drop with virt "Larry Barowski" <larry.barowski@THRWHITE.remove-dii-this> - 2011-04-27 15:35 +0000
            Re: Drag N Drop with virt "dbhomers" <dbhomers@THRWHITE.remove-dii-this> - 2011-04-27 15:35 +0000
              Re: Drag N Drop with virt "Larry Barowski" <larry.barowski@THRWHITE.remove-dii-this> - 2011-04-27 15:35 +0000

#1872 — Drag N Drop with virtual

From"Dirk Becker" <dirk.becker@THRWHITE.remove-dii-this>
Date2011-04-27 15:35 +0000
SubjectDrag N Drop with virtual
Message-ID<ouZ1q2mVZnDBMZuudbhomers@becker-print-soft.com>
  To: comp.lang.java.gui
Hi, i need to drop a virtual File (it doesnt exist cause its a part from
an archive) to the local File-System.
This must only be work under Windows, other platforms are irrelevant.

In C# you can create an temporary File with 0 Bytes, after the
Mouse-Button is released you can fill the temp Files with Data and then
the System can move the Files from temp to Drop-Location.

In Java I cant find any solution to do this, i only can extract the
files when the User starts dragging. If i had to extract an 10 MB file
the user must wait a minute until he can release the Button ;)


Or is there a way to do the same like in c++ with CFSTR_FILECONTENTS and
CFSTR_FILEDESCRIPTOR.
Extracting on the fly .. but i think this is not possible :(

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [next] | [standalone]


#1874 — Re: Drag N Drop with virt

From"bcr666" <bcr666@THRWHITE.remove-dii-this>
Date2011-04-27 15:35 +0000
SubjectRe: Drag N Drop with virt
Message-ID<1182438149.934036.74900@c77g2000hse.googlegroups.com>
In reply to#1872
  To: comp.lang.java.gui
On Jun 20, 4:03 pm, "Dirk Becker" <dbhom...@becker-print-soft.com>
wrote:
> Hi, i need to drop a virtual File (it doesnt exist cause its a part from
> an archive) to the local File-System.
> This must only be work under Windows, other platforms are irrelevant.
>
> In C# you can create an temporary File with 0 Bytes, after the
> Mouse-Button is released you can fill the temp Files with Data and then
> the System can move the Files from temp to Drop-Location.
>
> In Java I cant find any solution to do this, i only can extract the
> files when the User starts dragging. If i had to extract an 10 MB file
> the user must wait a minute until he can release the Button ;)
>
> Or is there a way to do the same like in c++ with CFSTR_FILECONTENTS and
> CFSTR_FILEDESCRIPTOR.
> Extracting on the fly .. but i think this is not possible :(

You could just create a java.io.File object at the location the user
drops the virtual file.  There will actually be nothing there on the
disk, but you can use the File object to get a stream, to dump your
data to.  After you write, flush and close the stream, you can rename
the File object.

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [prev] | [next] | [standalone]


#1876 — Re: Drag N Drop with virt

From"Larry Barowski" <larry.barowski@THRWHITE.remove-dii-this>
Date2011-04-27 15:35 +0000
SubjectRe: Drag N Drop with virt
Message-ID<FMKdnbyUdOikS-bbnZ2dnUVZ_vGinZ2d@comcast.com>
In reply to#1872
  To: comp.lang.java.gui

"Dirk Becker" <dbhomers@becker-print-soft.com> wrote in message 
news:ouZ1q2mVZnDBMZuudbhomers@becker-print-soft.com...
> Hi, i need to drop a virtual File (it doesnt exist cause its a part from
> an archive) to the local File-System.
> This must only be work under Windows, other platforms are irrelevant.
>
> In C# you can create an temporary File with 0 Bytes, after the
> Mouse-Button is released you can fill the temp Files with Data and then
> the System can move the Files from temp to Drop-Location.
>
> In Java I cant find any solution to do this, i only can extract the
> files when the User starts dragging. If i had to extract an 10 MB file
> the user must wait a minute until he can release the Button ;)

In your Transferrable subclass, have getTransferData() create
and write the temporary files.

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [prev] | [next] | [standalone]


#1877 — Re: Drag N Drop with virt

From"Larry Barowski" <larry.barowski@THRWHITE.remove-dii-this>
Date2011-04-27 15:35 +0000
SubjectRe: Drag N Drop with virt
Message-ID<IJWdndGvMr3VSubbnZ2dnUVZ_jmdnZ2d@comcast.com>
In reply to#1876
  To: comp.lang.java.gui

"Larry Barowski" <MElarrybar-AT-eng_DOT_auburnANOTHERDOTeduEND> wrote in 
message news:FMKdnbyUdOikS-bbnZ2dnUVZ_vGinZ2d@comcast.com...
>
> In your Transferrable subclass, have getTransferData() create
> and write the temporary files.
>

Oops, I meant Transferrable implementation class, of course.

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [prev] | [next] | [standalone]


#1878 — Re: Drag N Drop with virt

From"dbhomers" <dbhomers@THRWHITE.remove-dii-this>
Date2011-04-27 15:35 +0000
SubjectRe: Drag N Drop with virt
Message-ID<1182522221.334604.84360@m36g2000hse.googlegroups.com>
In reply to#1877
  To: comp.lang.java.gui
On 22 Jun., 16:10, "Larry Barowski" <MElarrybar-AT-
eng_DOT_auburnANOTHERDOTeduEND> wrote:
> "Larry Barowski" <MElarrybar-AT-eng_DOT_auburnANOTHERDOTeduEND> wrote in
> messagenews:FMKdnbyUdOikS-bbnZ2dnUVZ_vGinZ2d@comcast.com...
>
>
>
> > In your Transferrable subclass, have getTransferData() create
> > and write the temporary files.
>
> Oops, I meant Transferrable implementation class, of course.

Hi, iam a little bit confused :/
I also had overwritten the getTransferData() and return a List<File>;
For Example i have my temporary File in this List: new File("/tmp/
empty.txt");
Now the File will be droped to an unknown Location "on the Filesystem
(not in my App!)".
After this Drop the File i got in the List also have the Path /tmp/
empty.txt
The same in exportDone(), Filepath is the old one, not the new one!

Should i return something other in getTransferData() ??

Thanks for your Help!

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [prev] | [next] | [standalone]


#1884 — Re: Drag N Drop with virt

From"Larry Barowski" <larry.barowski@THRWHITE.remove-dii-this>
Date2011-04-27 15:35 +0000
SubjectRe: Drag N Drop with virt
Message-ID<z7OdndaXeJN8v-DbnZ2dnUVZ_gydnZ2d@comcast.com>
In reply to#1878
  To: comp.lang.java.gui

<dbhomers@becker-print-soft.com> wrote in message 
news:1182522221.334604.84360@m36g2000hse.googlegroups.com...
> Hi, iam a little bit confused :/
> I also had overwritten the getTransferData() and return a List<File>;
> For Example i have my temporary File in this List: new File("/tmp/
> empty.txt");
> Now the File will be droped to an unknown Location "on the Filesystem
> (not in my App!)".
> After this Drop the File i got in the List also have the Path /tmp/
> empty.txt
> The same in exportDone(), Filepath is the old one, not the new one!
>
> Should i return something other in getTransferData() ??

You want to preserve the filenames, so create a temporary directory
and put them there with the actual names. That's what WinZip does.
My first thought when I needed to do this was "Well, how does
WinZip do it?". You can use System.getProperty("java.io.tmpdir") to
figure out where to put your temporary directory. Whatever app you
drop into will either copy from there or open from there.

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [prev] | [next] | [standalone]


#1890 — Re: Drag N Drop with virt

From"dbhomers" <dbhomers@THRWHITE.remove-dii-this>
Date2011-04-27 15:35 +0000
SubjectRe: Drag N Drop with virt
Message-ID<1182707897.252977.80470@w5g2000hsg.googlegroups.com>
In reply to#1884
  To: comp.lang.java.gui
On 23 Jun., 15:45, "Larry Barowski" <MElarrybar-AT-
eng_DOT_auburnANOTHERDOTeduEND> wrote:
> <dbhom...@becker-print-soft.com> wrote in message
>
> news:1182522221.334604.84360@m36g2000hse.googlegroups.com...
>
> > Hi, iam a little bit confused :/
> > I also had overwritten the getTransferData() and return a List<File>;
> > For Example i have my temporary File in this List: new File("/tmp/
> > empty.txt");
> > Now the File will be droped to an unknown Location "on the Filesystem
> > (not in my App!)".
> > After this Drop the File i got in the List also have the Path /tmp/
> > empty.txt
> > The same in exportDone(), Filepath is the old one, not the new one!
>
> > Should i return something other in getTransferData() ??
>
> You want to preserve the filenames, so create a temporary directory
> and put them there with the actual names. That's what WinZip does.
> My first thought when I needed to do this was "Well, how does
> WinZip do it?". You can use System.getProperty("java.io.tmpdir") to
> figure out where to put your temporary directory. Whatever app you
> drop into will either copy from there or open from there.

Yes, thats right! But that is not my intention to do!
Right now, i do it exactly that way and as i said in my first message:
"... I only can extract the files when the User starts dragging. If i
had to extract an 10 MB file the user must wait a minute until he can
release the Button ..."

What i need is a solution to extract between "User Released
Mousebutton" and "Filesystem will copy files" OR
find out the Drop-Location.

After playing a little bit with SunDragSourceContextPeer i think its
not possible to do that with Core-Java.
I think i will try if i can write a C-Library which can spy File-Drops
to System and than find out the location via active Window etc.

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [prev] | [next] | [standalone]


#1893 — Re: Drag N Drop with virt

From"Larry Barowski" <larry.barowski@THRWHITE.remove-dii-this>
Date2011-04-27 15:35 +0000
SubjectRe: Drag N Drop with virt
Message-ID<If2dnV7bX6EmVOLbnZ2dnUVZ_rSjnZ2d@comcast.com>
In reply to#1890
  To: comp.lang.java.gui

<dbhomers@becker-print-soft.com> wrote in message 
news:1182707897.252977.80470@w5g2000hsg.googlegroups.com...
> Yes, thats right! But that is not my intention to do!
> Right now, i do it exactly that way and as i said in my first message:
> "... I only can extract the files when the User starts dragging. If i
> had to extract an 10 MB file the user must wait a minute until he can
> release the Button ..."
>
> What i need is a solution to extract between "User Released
> Mousebutton" and "Filesystem will copy files" OR
> find out the Drop-Location.
>
> After playing a little bit with SunDragSourceContextPeer i think its
> not possible to do that with Core-Java.
> I think i will try if i can write a C-Library which can spy File-Drops
> to System and than find out the location via active Window etc.

Ah, I didn't realize getTransferData() was called as soon as
a valid drop target is identified (but before the drop). I suppose
the targets need that if they display something about the
nature of the items to be dropped on mouse-over. I don't see
any way to tell the difference between a mouse-over and
actual drop. The methods in the call stack are identical for
both, and the line numbers are mostly unknown.

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.java.gui


csiph-web