I am working on an extension of Dialog which shows the progress of a Task and provides a ui to cancel the task. I am working with the new Dialog API in 8u40. The Task is started, when the dialog is shown. Displaying the progress works great. The dialog returns the result of the task when done.
I am having a problem closing the dialog, when the user cancels the task. I am trying to do this by
task.setOnCancelled(event -> {
dialog.close(); // or dialog.setResult(null);
});
Unfortunately, this does not close the dialog as expected. Wrapping the close() in a Platform.runLater also doesn’t help.
To reproduce:
- Run CancelableTaskDialogTest (see comments)
- Press "Start long running task"
- Press Cancel
I am having a problem closing the dialog, when the user cancels the task. I am trying to do this by
task.setOnCancelled(event -> {
dialog.close(); // or dialog.setResult(null);
});
Unfortunately, this does not close the dialog as expected. Wrapping the close() in a Platform.runLater also doesn’t help.
To reproduce:
- Run CancelableTaskDialogTest (see comments)
- Press "Start long running task"
- Press Cancel