While viewing a JasperPrint document with it's document name set eg:
doc.setName("SpecialReport - 2013-08-13");
boolean exitOnClose = false;
JasperViewer view = JasperViewer(doc,exitOnClose);
When you click save button in the viewer, the file chooser dialog's default filename is empty.
I would suggest to default the filename to the JasperPrint's name.
In the latest 5.2.0 source in JRViewer starting line 1165 it will use the previous folder saved into:
if (lastFolder != null)
should be followed by:
//Set the filename and location to save in
if (jasperPrint != null && jasperPrint.getName() != null)
or possibly to allow further customization, it would be great to pass through a default filename to the JRViewer utilize it:
JRViewer view = new JRViewer(doc);
view.setDefaultFilename("SpecialReport - 2013-08-13"); //new method
If this was the case then if the defaultFilename was set then the fileChooser could use that, if not then it could utilize
the JasperPrint name.
This would help make it easier to save using standardized filenames, but still allow the user to view and then save the report using
that standarized name while still allowing them to change the default and select the filetype.
A further enhancement would be to allow setting the "lastFolder" protected file by way of adding a "setDefaultFileSaveLocation(File)" method to
JRViewer to initialize a desired initial save folder. (eg for defaulting invoices to be saved in an invoices in one folder, receipts in another folder)