示例#1
0
    public void setTask(Task<?> task) {
      if (_task != null) {
        _task.cancel();
        _animation.stop();
        visibleProperty().unbind();
        log.info("Task Canceled");
      }

      _task = task;
      if (_task != null) {
        visibleProperty().bind(task.runningProperty());
        _task
            .runningProperty()
            .addListener(
                o -> {
                  SimpleBooleanProperty running = (SimpleBooleanProperty) o;
                  if (running.get()) {
                    _animation.play();
                  } else {
                    _animation.stop();
                  }
                });

        task.setOnFailed(
            e -> {
              log.error(_task.getMessage());
              setTask(null);
            });
      }
    }
示例#2
0
 @Override
 public void stop() {
   rotateTransition.stop();
 }