A task sets its progress by calling updateProgress(), and having a GUI widget like a ProgressIndicator having its progressProperty bound to the task's progressProperty. However, the article here also mentions calling updateMessage in Example 5 but the example is incomplete.
http://docs.oracle.com/javafx/2/threads/jfxpub-threads.htm
It is not clear to me where/how the message is displayed since there is no message property in ProgressIndicator nor ProgressBar to bind it to. I see that Task inherits message property from Worker class. http://docs.oracle.com/javafx/2/api/javafx/concurrent/Task.html
But how will the GUI get a hold of it and perform the binding since Task is visible only to Service?
I couldn't find working examples of this. In the Ensemble sample, the Service example has a ProgressIndicator but again, no message is updated. http://download.oracle.com/otndocs/products/javafx/2.2/samples/Ensemble/index.html
I am able to use myController.service.messageProperty() to access the messageProperty of Task.
myTextArea.textProperty().bind(myController.myService.messageProperty());
Note that this does an overwrite of, rather than an appending to, the TextArea.
To do an append, one must bind a ChangeListener to the message property instead.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With