* Remove Destination attribute otherwise.
*/
private void updatePrintToFile() {
if (toFileBox.isEnabled() && toFileBox.isSelected()) {
Destination dest = (Destination)
(newAttrs.containsKey(Destination.class)
? newAttrs.get(Destination.class)
: myService.getDefaultAttributeValue(Destination.class));
File file = null;
DestinationChooser chooser = new DestinationChooser();
if (dest == null) {
dest = new Destination((new File("out.prn")).toURI());
/* Default file name for the output file is "out.prn" */
}
try {
file = new File(dest.getURI());
} catch (Exception e) {
file = new File("out.prn");
}
chooser.setSelectedFile(file);
chooser.setDialogTitle("Print to file");
int chooserResult = chooser.showDialog(printDialog, "OK");
if (chooserResult == JFileChooser.APPROVE_OPTION) {
try {
URI selectedFile = chooser.getSelectedFile().toURI();
newAttrs.add(new Destination(selectedFile));
} catch (Exception e) {
removeAttribute(Destination.class);
}
}
} else {