-
Bug
-
Resolution: Fixed
-
P2
-
fx2.0.2, fx2.0.3
-
windows xp 32-bit, FF, Chrome, JavaFX 2.0.2
Java Plug-in 10.2.1.255
Using JRE version 1.7.0_02-b13 Java HotSpot(TM) Client VM
I have an application that provides a feature to export part of the scene as an image. I'm using FileSaveService to do that..something like that:
exportWorkflowButton.setOnAction(new EventHandler<ActionEvent>() {
public void handle(ActionEvent event) {
try {
if(fileSaveService == null)//lazy init
fileSaveService = (FileSaveService) ServiceManager.lookup("javax.jnlp.FileSaveService");
Object renderToImage = canvas.renderToImage(null, 1.5f);
Image sceneImage = Image.impl_fromPlatformImage(renderToImage);
ByteArrayOutputStream os = new ByteArrayOutputStream();
ImageIO.write(ImageConverter.convertToAwtImage(sceneImage), "png", os);
InputStream imageInputStream = new ByteArrayInputStream(os.toByteArray());
//Save the image using the JNLP FileSaveService
fileSaveService.saveFileDialog(null, supportedImageExportExtensions, imageInputStream, workSession.getWorkflow().getId()+".png");
} catch(Exception e) { //Can't locate JNLP service or can't write to filesystem
logger.warning("Can't export canvas to image, due to: " + formatStackTrace(e));
DialogManager.showErrorDialog(ImperiaResourceBundle.getBundle().getString("gui.error.exportToImage"));
}
}
});
When the user clicks on the Export button: there's a File Chooser Dialog(swing-based ?!)... then the user needs to input a filename.
If the user selects an existing file and clicks 'Save' the applet crashes. Otherwise if there's no an existing file the image is saved correctly
exportWorkflowButton.setOnAction(new EventHandler<ActionEvent>() {
public void handle(ActionEvent event) {
try {
if(fileSaveService == null)//lazy init
fileSaveService = (FileSaveService) ServiceManager.lookup("javax.jnlp.FileSaveService");
Object renderToImage = canvas.renderToImage(null, 1.5f);
Image sceneImage = Image.impl_fromPlatformImage(renderToImage);
ByteArrayOutputStream os = new ByteArrayOutputStream();
ImageIO.write(ImageConverter.convertToAwtImage(sceneImage), "png", os);
InputStream imageInputStream = new ByteArrayInputStream(os.toByteArray());
//Save the image using the JNLP FileSaveService
fileSaveService.saveFileDialog(null, supportedImageExportExtensions, imageInputStream, workSession.getWorkflow().getId()+".png");
} catch(Exception e) { //Can't locate JNLP service or can't write to filesystem
logger.warning("Can't export canvas to image, due to: " + formatStackTrace(e));
DialogManager.showErrorDialog(ImperiaResourceBundle.getBundle().getString("gui.error.exportToImage"));
}
}
});
When the user clicks on the Export button: there's a File Chooser Dialog(swing-based ?!)... then the user needs to input a filename.
If the user selects an existing file and clicks 'Save' the applet crashes. Otherwise if there's no an existing file the image is saved correctly