|
|
|
|
AjaxSwing supports file upload and download thru JFileChooser dialog.
File Upload
JFileChooser of type OPEN_DIALOG is rendered as file upload in the browser. If a component such as JButton displays
JFileChooser, a uniform file upload dialog is shown in the browser where a user can select a file to be uploaded and then
submit the page. Most of the browsers provide file browsing dialog so this makes the intermediate file upload dialog unnecessary.
AjaxSwing provides a method to skip the intermediate dialog and directly display browser's file selection dialog when a button
or a menu item is clicked. To take advantage of that functionality Swing application has to do the following:
- Have a class that implements
com.creamtec.ajaxswing.support.FileOpener interface
- Associate JButton or JMenuItem with the opener using
ComponentUtils.setFileOpener() method
See com.creamtec.ajaxswing.ui.FixedDialog.java for an example of implementation.
File Download
JFileChooser of type SAVE_DIALOG is rendered as file download. AjaxSwing detects when Swing application displays that dialog,
which point it automatically closes it and streams download to the browser. No custom application code is required
|
|
|
|
|
|