本文整理了Java中javafx.concurrent.Worker.getState()
方法的一些代码示例,展示了Worker.getState()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Worker.getState()
方法的具体详情如下:
包路径:javafx.concurrent.Worker
类名称:Worker
方法名:getState
暂无
代码示例来源:origin: org.controlsfx/controlsfx
public final void setWorker(final Worker<?> newWorker) {
if (newWorker != worker) {
if (worker != null) {
worker.stateProperty().removeListener(stateListener);
end();
}
worker = newWorker;
if (newWorker != null) {
newWorker.stateProperty().addListener(stateListener);
if (newWorker.getState() == Worker.State.RUNNING || newWorker.getState() == Worker.State.SCHEDULED) {
// It is already running
begin();
}
}
}
}
代码示例来源:origin: io.datafx/core
public static ReadOnlyBooleanProperty createIsDoneProperty(Worker<?> worker) {
final BooleanProperty property = new SimpleBooleanProperty();
Consumer<Worker.State> stateChecker = (s) -> {
if (s.equals(Worker.State.CANCELLED) || s.equals(Worker.State.FAILED) || s.equals(Worker.State.SUCCEEDED)) {
property.setValue(true);
} else {
property.setValue(false);
}
};
worker.stateProperty().addListener((o, oldValue, newValue) -> stateChecker.accept(newValue));
stateChecker.accept(worker.getState());
return property;
}
}
代码示例来源:origin: org.apache.jmeter/ApacheJMeter_components
private void createScene(final String htmlContent) {
Platform.setImplicitExit(false);
Platform.runLater(() -> {
WebView view = new WebView();
engine = view.getEngine();
engine.setOnStatusChanged(event -> SwingUtilities.invokeLater(() -> lblStatus.setText(event.getData())));
engine.getLoadWorker().workDoneProperty()
.addListener((ChangeListener<Number>) (observableValue, oldValue, newValue) -> SwingUtilities
.invokeLater(() -> progressBar.setValue(newValue.intValue())));
engine.getLoadWorker().exceptionProperty()
.addListener((ObservableValue<? extends Throwable> o,
Throwable old, final Throwable value) -> {
if (engine.getLoadWorker().getState() == State.FAILED) {
SwingUtilities.invokeLater(() -> JOptionPane
.showMessageDialog(
resultsScrollPane,
(value != null) ? engine
.getLocation()
+ "\n"
+ value.getMessage()
: engine.getLocation()
+ "\nUnexpected error.",
"Loading error...",
JOptionPane.ERROR_MESSAGE));
}
});
jfxPanel.setScene(new Scene(view));
});
}
代码示例来源:origin: stackoverflow.com
Worker worker = webEngine.getLoadWorker();
worker.stateProperty().addListener((Observable o) -> {
if (worker.getState() == Worker.State.SUCCEEDED) {
EventQueue.invokeLater(() -> {
table.setModel(new AbstractTableModel() {
代码示例来源:origin: org.controlsfx/controlsfx
public ProgressDialog(final Worker<?> worker) {
if (worker != null
&& (worker.getState() == State.CANCELLED
|| worker.getState() == State.FAILED
|| worker.getState() == State.SUCCEEDED)) {
return;
内容来源于网络,如有侵权,请联系作者删除!