Search in sources :

Example 1 with ProgressableCmd

use of org.malai.javafx.command.ProgressableCmd in project Malai by arnobl.

the class BindingTask method call.

@Override
protected Boolean call() {
    final DoubleProperty progProp = cmd instanceof ProgressableCmd ? ((ProgressableCmd) cmd).progress() : null;
    final StringProperty textProp = cmd instanceof ProgressableCmd ? ((ProgressableCmd) cmd).textProgress() : null;
    if (progProp != null) {
        progProp.addListener(updateProgress);
    }
    if (textProp != null) {
        textProp.addListener(updateTextProgress);
    }
    final boolean ok = cmd.doIt();
    if (progProp != null) {
        progProp.removeListener(updateProgress);
    }
    if (textProp != null) {
        textProp.removeListener(updateTextProgress);
    }
    return ok;
}
Also used : StringProperty(javafx.beans.property.StringProperty) DoubleProperty(javafx.beans.property.DoubleProperty) ProgressableCmd(org.malai.javafx.command.ProgressableCmd)

Aggregations

DoubleProperty (javafx.beans.property.DoubleProperty)1 StringProperty (javafx.beans.property.StringProperty)1 ProgressableCmd (org.malai.javafx.command.ProgressableCmd)1