Beispiel #1
0
 private void nextPane(Service<Rectangle> recBuilder) {
   loading[counter].textProperty().bind(recBuilder.messageProperty());
   indicators[counter]
       .visibleProperty()
       .bind(
           recBuilder
               .progressProperty()
               .isNotEqualTo(new SimpleDoubleProperty(ProgressBar.INDETERMINATE_PROGRESS)));
   recBuilder.restart();
 }
  private void bindServiceToControl(ServiceAndTask demoControl, Service<String> service) {

    demoControl.startService.setOnMouseClicked(
        (val) -> {
          if (!service.isRunning()) {
            service.reset();
            service.start();
            demoControl.labelService.textProperty().bind(service.messageProperty());
          }
        });

    demoControl.labelService.textProperty().bind(service.messageProperty());

    service.addEventHandler(
        WorkerStateEvent.WORKER_STATE_SUCCEEDED,
        (val) -> {
          demoControl.labelService.textProperty().unbind();
          demoControl.labelService.setText(service.getValue());
        });

    demoControl.progressService.progressProperty().bind(service.progressProperty());
  }