本文整理了Java中javafx.concurrent.Worker.stateProperty()
方法的一些代码示例,展示了Worker.stateProperty()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Worker.stateProperty()
方法的具体详情如下:
包路径:javafx.concurrent.Worker
类名称:Worker
方法名:stateProperty
暂无
代码示例来源:origin: io.datafx/core
public static <V> BooleanBinding isFinishedProperty(Worker<V> worker) {
return worker.stateProperty().isEqualTo(Worker.State.CANCELLED).or(worker.stateProperty().isEqualTo(Worker.State.FAILED).or(worker.stateProperty().isEqualTo(Worker.State.SUCCEEDED)));
}
代码示例来源:origin: org.netbeans.html/net.java.html.boot.fx
private boolean checkValid() {
final String crnt = view.getEngine().getLocation();
if (previous != null && !previous.equals(crnt)) {
w.stateProperty().removeListener(this);
return false;
}
previous = crnt;
return true;
}
代码示例来源:origin: org.netbeans.html/net.java.html.boot.fx
private boolean checkValid() {
final String crnt = webView.getEngine().getLocation();
if (previous != null && !previous.equals(crnt)) {
w.stateProperty().removeListener(this);
return false;
}
previous = crnt;
return true;
}
});
代码示例来源:origin: PhoenicisOrg/phoenicis
@Override
public void waitForBeingLoaded() {
final Semaphore lock = new Semaphore(0);
Platform.runLater(() -> webView.getEngine().getLoadWorker().stateProperty()
.addListener(((observableValue, oldState, newState) -> {
if (newState == Worker.State.SUCCEEDED) {
lock.release();
}
})));
try {
lock.acquire();
} catch (InterruptedException e) {
this.messageWaitingForResponse.sendCancelSignal();
}
}
代码示例来源: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: PhoenicisOrg/phoenicis
@Override
public void waitForUrl(String urlMatch) {
final Semaphore lock = new Semaphore(0);
Platform.runLater(() -> webView.getEngine().getLoadWorker().stateProperty()
.addListener(((observableValue, oldState, newState) -> {
if (newState == Worker.State.SUCCEEDED && urlMatches(getCurrentUrl(), urlMatch)) {
lock.release();
}
})));
try {
lock.acquire();
} catch (InterruptedException e) {
this.messageWaitingForResponse.sendCancelSignal();
}
}
代码示例来源:origin: org.netbeans.html/net.java.html.boot.fx
@Override
WebView findView(final URL resource) {
final Worker<Void> w = webView.getEngine().getLoadWorker();
w.stateProperty().addListener(new ChangeListener<Worker.State>() {
private String previous;
@Override
public void changed(ObservableValue<? extends Worker.State> ov, Worker.State t, Worker.State newState) {
if (newState.equals(Worker.State.SUCCEEDED)) {
if (checkValid()) {
onPageLoad();
}
}
if (newState.equals(Worker.State.FAILED)) {
checkValid();
throw new IllegalStateException("Failed to load " + resource);
}
}
private boolean checkValid() {
final String crnt = webView.getEngine().getLocation();
if (previous != null && !previous.equals(crnt)) {
w.stateProperty().removeListener(this);
return false;
}
previous = crnt;
return true;
}
});
return webView;
}
代码示例来源: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: brunoborges/webfx
webEngine.getLoadWorker().stateProperty().addListener((ObservableValue<? extends State> ov, State oldv, State newv) -> {
if (newv == State.SUCCEEDED) {
Document document = (Document) webEngine.executeScript("document");
代码示例来源:origin: com.github.vatbub/common.view.motd
rssWebView.getEngine().getLoadWorker().stateProperty().addListener((observable, oldValue, newValue) -> {
if (newValue != Worker.State.SUCCEEDED) {
return;
代码示例来源:origin: net.sf.sf3jswing/kernel-core
webEngine.getLoadWorker().stateProperty().addListener(new javafx.beans.value.ChangeListener<Worker.State>() {
@Override
public void changed(ObservableValue<? extends Worker.State> ov,
代码示例来源:origin: stackoverflow.com
WebEngine webEngine = webView.getEngine();
Worker worker = webEngine.getLoadWorker();
worker.stateProperty().addListener((Observable o) -> {
if (worker.getState() == Worker.State.SUCCEEDED) {
EventQueue.invokeLater(() -> {
代码示例来源:origin: cpesch/RouteConverter
webView.getEngine().getLoadWorker().stateProperty().addListener(new ChangeListener<State>() {
private int startCount;
代码示例来源:origin: com.nexitia.emaginplatform/emagin-jfxcore-demoapp
browser.heightProperty().addListener(e -> mapResized());
webEngine.getLoadWorker().stateProperty().addListener(new ChangeListener<Worker.State>() {
@Override
public void changed(ObservableValue ov, Worker.State oldState, Worker.State newState) {
代码示例来源:origin: net.sf.sf3jswing/kernel-core
webEngine.getLoadWorker().stateProperty().addListener(new ChangeListener<State>() {
@Override
public void changed(ObservableValue<? extends State> ov,
代码示例来源:origin: org.apidesign.html/boot-fx
root.setCenter(view);
final Worker<Void> w = view.getEngine().getLoadWorker();
w.stateProperty().addListener(new ChangeListener<Worker.State>() {
@Override
public void changed(ObservableValue<? extends Worker.State> ov, Worker.State t, Worker.State newState) {
代码示例来源:origin: org.controlsfx/controlsfx
eng.getLoadWorker().stateProperty().addListener(new ChangeListener<State>() {
@Override public void changed(javafx.beans.value.ObservableValue<? extends State> o, State oldValue, State newValue) {
if (newValue == State.SUCCEEDED) {
代码示例来源:origin: org.netbeans.html/net.java.html.boot.fx
bp.setCenter(view);
final Worker<Void> w = view.getEngine().getLoadWorker();
w.stateProperty().addListener(new ChangeListener<Worker.State>() {
private String previous;
内容来源于网络,如有侵权,请联系作者删除!