gpt4 book ai didi

javafx.concurrent.WorkerStateEvent.getSource()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-23 01:41:05 27 4
gpt4 key购买 nike

本文整理了Java中javafx.concurrent.WorkerStateEvent.getSource()方法的一些代码示例,展示了WorkerStateEvent.getSource()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WorkerStateEvent.getSource()方法的具体详情如下:
包路径:javafx.concurrent.WorkerStateEvent
类名称:WorkerStateEvent
方法名:getSource

WorkerStateEvent.getSource介绍

暂无

代码示例

代码示例来源:origin: stackoverflow.com

myTask.setOnSucceeded(new EventHandler<WorkerStateEvent>() {

  @SuppressWarnings("unchecked")
  @Override
  public void handle(WorkerStateEvent event) {
    ReturnType rt =  (ReturnType) event.getSource().getValue()
    // ... other stuff to do here ...
  }
});

代码示例来源:origin: stackoverflow.com

public abstract class EventCallback<T> implements EventHandler<WorkerStateEvent> {

@Override
public void handle(final WorkerStateEvent workerStateEvent) {
  T returnType = (T) workerStateEvent.getSource().valueProperty().get();
  this.handle(returnType);
}

public abstract void handle(T objectReturned);

}

代码示例来源:origin: org.jrebirth.af/core

@Override
  public void handle(final WorkerStateEvent event) {
    TaskTrackerService.this.serviceTasks.remove(event.getSource());
  }
};

代码示例来源:origin: stackoverflow.com

FirstLineService service = new FirstLineService();
service.setUrl("http://google.com");
service.setOnSucceeded(new EventHandler<WorkerStateEvent>() {

  @Override
  public void handle(WorkerStateEvent t) {
    System.out.println("done:" + t.getSource().getValue());
  }
});

service.start();

代码示例来源:origin: com.powsybl/powsybl-gse-util

public static <T> Service<T> createService(Task<T> task, Executor executor) {
  Service<T> service = new Service<T>() {
    @Override
    protected Task<T> createTask() {
      return task;
    }
  };
  service.setExecutor(executor);
  service.setOnFailed(event -> {
    Throwable exception = event.getSource().getException();
    if (exception != null) {
      LOGGER.error(exception.toString(), exception);
      showDialogError(exception);
    }
  });
  return service;
}

代码示例来源:origin: org.copper-engine/copper-monitoring-client

@Override
  public void handle(WorkerStateEvent event) {
    try {
      @SuppressWarnings("unchecked")
      FilterAbleForm.ResultFilterPair<F, R> result = (FilterAbleForm.ResultFilterPair<F, R>) event.getSource().getValue();
      filterResultController.showFilteredResult(result.result, result.usedFilter);
    } catch (Exception e) {
      exceptionHandler.reportError(e);
    }
  }
});

代码示例来源:origin: org.controlsfx/controlsfx

|| evt.getEventType().equals(
      WorkerStateEvent.WORKER_STATE_FAILED)) {
getTasks().remove(evt.getSource());

代码示例来源:origin: com.powsybl/powsybl-gse-afs-ext-base

private void updateScript() {
  scriptUpdateService = GseUtil.createService(new Task<String>() {
    @Override
    protected String call() {
      return storableScript.readScript();
    }
  }, context.getExecutor());
  progressIndicator.visibleProperty().bind(scriptUpdateService.runningProperty());
  codeEditor.disableProperty().bind(scriptUpdateService.runningProperty());
  scriptUpdateService.setOnSucceeded(event -> {
    String scriptContent = (String) event.getSource().getValue();
    codeEditor.setCode(scriptContent);
    saved.set(true);
  });
  scriptUpdateService.start();
}

代码示例来源:origin: com.powsybl/powsybl-gse-security-analysis

@Override
public void view() {
  progressIndic.visibleProperty().bind(resultLoadingService.runningProperty());
  tabPane.disableProperty().bind(resultLoadingService.runningProperty());
  resultLoadingService.setOnSucceeded(event -> {
    SecurityAnalysisResult result = (SecurityAnalysisResult) event.getSource().getValue();
    if (result != null) {
      preContResultPane.setResult(result.getPreContingencyResult());
      postContResultPane.setResults(result.getPostContingencyResults());
    } else {
      preContResultPane.setResult(null);
      postContResultPane.setResults(null);
    }
    preContResultPane.loadPreferences();
    postContResultPane.loadPreferences();
  });
  resultLoadingService.start();
}

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com