Spirit of Web vs. Open File
Below are a few notes on getting a file dialog to work in GWT. The assumption really violates the spirit of web applications as they are currenly understood because of reasonable browser security issues. One approach to making things work fairly easily is to have the browser based application always look at a web server, even if it is local. Then the file resources are easily accessable to the browser based application. Consider an application which needs to digest textual output from complex image processing tools: the output files need to be deposited into the server's content area. Then everything is simple. Even more important, thearchiecture of the system remains unchanged if and when the image server provides a richer interface than text files because one will always want the giant image files to be managed by the server.
EXT-JS
Like most programming languages, Javascript has libraries. One of the most powerful is ext-js, which is supported directly by the GWT. Read all about it here. The widgets of ext-js are also directly supported by Instantiations GWT Designer. There may be better libraries, Dojo certainly has a great reputation, but GWT's support makes it a sensible first choice.
Still, I was disappointed that I could not find direct support for an open file dialog easily. Eventually I noticed a BrowseButton, which seems to to the right thing. In google code I found documentation for gwt-ext-ux (GWT-Ex User Extensions) which has documentation on BrowseButton. It looks like the right thing, although I'm not sure it allows one to read the contents of the file. I hope it will not be necessary to send the file to the server and then get its contents back, but that could work.
Its also possible that a web-oriented Python library/framework would do the job more directly without having to look at libraries like ext-js directly.
If it is a complex as it appears in the BrowserButton docs to do this, I'm disappointed. I think all this appears more complext than needed because I don't have much experience with Javascript (exactly why I want a library to hide the details).
Tuesday, October 27, 2009
Subscribe to:
Posts (Atom)