How do I load test data into my Widget

21 views
Skip to first unread message

DemiSheep

unread,
Aug 16, 2011, 3:14:23 PM8/16/11
to Google Web Toolkit
I am using the Google Toolkit and I have created a widget with a
listbox, vertical split panel and a couple of buttons. What I am
trying to do is have a list of files in a local directory listed in
the listbox and I want to be able to click on a file and have it
displayed in the top part of the split panel. I found out the hard way
about browsers and file IO and not being able to use java.io.File.

What are my options? Can I put the data files inside a jar or
something and have the widget read it in that way? I need to do this
as a test run, to implement an new feature with working with the data.
It's not going to be any kind of final server hosted application, I am
not concerned about how the actual files will be loaded in the future.

Any suggestions would be greatly appreciated.

Respectfully,
DemiSheep

Jim Douglas

unread,
Aug 16, 2011, 3:33:52 PM8/16/11
to Google Web Toolkit
Set aside implementation details for a second; what are you actually
trying to accomplish?

The short answer, to respond to the question as you've phrased it
here, is that it's impossible(*) to write a browser-based application
(with GWT, hand-crafted JavaScript, or any toolkit) that will
programmatically retrieve a list of files on the client. Browser
security rules forbid anything like that (for obvious reasons -- it
would be Very Not Good if any random web page had the ability to go
snooping around in your filesystem).

(*) In this context, "impossible" disregards messing around with local
security policy files and/or using browser-specific hacks.

BST

unread,
Aug 17, 2011, 7:01:22 AM8/17/11
to google-we...@googlegroups.com
I guess what you are looking for is uploading the files or keeping the files in server and displaying the list of available files in a location at server or war file and when clicked display the contents of the file.

DemiSheep

unread,
Aug 17, 2011, 9:05:29 AM8/17/11
to Google Web Toolkit
I am trying to write a widget which will be used to attach notes to
documents. So I am trying to setup a mock environment to simulate
this. My main focus is the notes for the documents, which I can store
anywhere, but I had thought I'd store them at the end of the files I
am viewing. Is there a place I can store the data files to be access
the way I need without a lot of trouble? :)

DemiSheep

unread,
Aug 17, 2011, 9:06:48 AM8/17/11
to Google Web Toolkit
Can I put the files in a war file and have the client open the files
for viewing?? What you described is exactly what I want to do. Click
on a available file in a list and then have it displayed in another
panel. Then my main focus is to attach a note to the file.

DemiSheep

unread,
Aug 17, 2011, 1:27:59 PM8/17/11
to Google Web Toolkit
I think I'll just hard code a couple of the files for my purposes.

Respectfully,
DemiSheep
Reply all
Reply to author
Forward
0 new messages