Example usage for javafx.concurrent Task runningProperty

List of usage examples for javafx.concurrent Task runningProperty

Introduction

In this page you can find the example usage for javafx.concurrent Task runningProperty.

Prototype

@Override
    public final ReadOnlyBooleanProperty runningProperty() 

Source Link

Usage

From source file:poe.trade.assist.Main.java

public void manualTaskRun(Search search) {
    String url = search.getUrl();
    if (isNotBlank(url)) {
        Task<Search> task = new Task<Search>() {
            @Override/*from ww w  .  j av  a 2 s.  c o  m*/
            protected Search call() throws Exception {
                String html = AutoSearchService.doDownload(search.getUrl(), search.getSort());
                search.setHtml(html);
                search.parseHtml();
                return search;
            }
        };
        resultPane.progressIndicator.visibleProperty().unbind();
        resultPane.progressIndicator.visibleProperty().bind(task.runningProperty());
        task.setOnSucceeded(e -> {
            resultPane.setSearch(task.getValue());
            //            refreshResultColumn();
        });
        task.setOnFailed(e -> {
            Dialogs.showError(task.getException());
            //            refreshResultColumn();
        });
        new Thread(task).start();
    } else {
        resultPane.setSearch(search);
    }
}