From: David Lamb on 26 Mar 2010 06:05 Some months ago people here advised me to use Java Web Start (jnlp) to develop something, and I'm finally getting time to begin investigating how to use the javax.jnlp package. I've just implemented the action for opening a file using the openFileDialog of the file opening service, and selecting a file and reading its contents works fine. I've not been able to find any explanation of how to use the path hint parameter, though; the javadocs and tutorial just say it's a hint and nothing about what sort of hint to give, other than supplying "null" for default behaviour. Can anyone tell me how to use this parameter? Can it be used to, for example, start the next dialog in the same directory as the previous one?
From: Andrew Thompson on 26 Mar 2010 23:22 On Mar 26, 9:05 pm, David Lamb <dal...(a)cs.queensu.ca> wrote: >...I've just implemented the action for > opening a file using the openFileDialog of the file opening service, > ...I've not been > able to find any explanation of how to use the path hint parameter, AFAIU, it is the path of a directory. > though; the javadocs and tutorial just say it's a hint and nothing about > what sort of hint to give, other than supplying "null" for default > behaviour. > > Can anyone tell me how to use this parameter? Supply the absolute path to a directory. >.. Can it be used to, for > example, start the next dialog in the same directory as the previous one? Nope, not as far as I can see. Since neither the FileOpenService or FileContents will provide the path to the resource the user chose (only its name, in the case of FileContents) it is impossible to get the path for the current FOS. About the only place I can see the file hint being useful is in: a) Secure code where we can supply things like ${user.home} explicitly, or b) When using the FS or the ExtendedService with a File that we already know the path of. E.G. when the app. has a File association defined & the user 'double clicks' an associated file type, the entire path of that File is supplied as an argument to the main(String[]). Actually, my point 'a' is a bit disingenuous, since it would require all-permissions to get the values of the secure properties, we might as well just use a standard JFileChooser and be done with it. -- Andrew T. pscode.org
From: markspace on 27 Mar 2010 01:57 David Lamb wrote: > Can anyone tell me how to use this parameter? Can it be used to, for > example, start the next dialog in the same directory as the previous one? The docs say: "pathHint - A hint from the application to the initial directory for the file chooser. This might be ignored by the JNLP Client." http://java.sun.com/j2se/1.5.0/docs/guide/javaws/jnlp/index.html
From: David Lamb on 27 Mar 2010 09:42 Andrew Thompson wrote: > On Mar 26, 9:05 pm, David Lamb <dal...(a)cs.queensu.ca> wrote: >> ...I've just implemented the action for >> opening a file using the openFileDialog of the file opening service, >> ...I've not been >> able to find any explanation of how to use the path hint parameter, > About the only place I can see the file hint being > useful is in: > a) Secure code where we can supply things like ${user.home} > explicitly, or Actually I'm contemplating writing two versions, one assuming all-permssions and one not. I expect I'll have to research how to detect programmatically whether this has happened -- still digging into the various APIs! > b) When using the FS or the ExtendedService with a File > that we already know the path of. E.G. when the app. > has a File association defined & the user 'double clicks' > an associated file type, the entire path of that File is > supplied as an argument to the main(String[]). Not possible in this particular application, since the file type is already owned by a separate application, but it would help for future projects. I can certainly "guess" at the path in this very special case, since they're almost always in a particular subdirectory of user.home and the file dialog seems to start there anyway.
From: David Lamb on 27 Mar 2010 09:42 markspace wrote: > David Lamb wrote: > >> Can anyone tell me how to use this parameter? Can it be used to, for >> example, start the next dialog in the same directory as the previous one? > > > The docs say: I said in the OP that I'd done due dilligence by reading the docs and tutorial. Perhaps I should have guessed that "path hint" meant an actual absolute path string as Andrew clarified, but I didn't.
|
Next
|
Last
Pages: 1 2 Prev: How should I re-write this? Next: Snapshot of List [Was: Re: sync on local variable] |