use of netscape.javascript.JSObject in project azure-tools-for-java by Microsoft.
the class JobViewPanel method init.
private void init(final JFXPanel panel) {
String url = rootPath + "/com.microsoft.hdinsight/hdinsight/job/html/index.html";
url = url.replace("\\", "/");
final String queryString = "?projectid=" + id + "&engintype=javafx";
final String weburl = "file:///" + url + queryString;
Platform.setImplicitExit(false);
Platform.runLater(() -> {
webView = new WebView();
webEngine = webView.getEngine();
webEngine.setJavaScriptEnabled(true);
webEngine.getLoadWorker().stateProperty().addListener((ObservableValue<? extends Worker.State> ov, Worker.State oldState, Worker.State newState) -> {
if (newState == Worker.State.SUCCEEDED) {
JSObject win = (JSObject) webEngine.executeScript("window");
win.setMember("JobUtils", jobUtil);
}
});
panel.setScene(new Scene(webView));
if (!alreadyLoad) {
webEngine.load(weburl);
alreadyLoad = true;
}
});
}
use of netscape.javascript.JSObject in project L42 by ElvisResearchGroup.
the class Frame method createHtmlContent.
private void createHtmlContent(JFXPanel jfxPanel, String html) {
CountDownLatch latch = new CountDownLatch(1);
FutureTask<Void> future = new FutureTask<Void>(() -> initWeb(latch, jfxPanel, html));
Platform.runLater(future);
try {
future.get();
} catch (ExecutionException e) {
throw propagateException(e.getCause());
} catch (InterruptedException e) {
throw propagateException(e);
}
try {
latch.await();
} catch (InterruptedException e) {
throw propagateException(e);
}
future = new FutureTask<Void>(() -> {
Object o = this.webEngine.executeScript("window.event42=function(s){ if(event42.eventCollector){event42.eventCollector.add(s);return 'Event '+s+' added '+event42.eventCollector.toString();} return 'Event '+s+' not added';}");
assert o instanceof JSObject : o.toString();
JSObject jsobj = (JSObject) o;
jsobj.setMember("eventCollector", this.events);
return null;
});
Platform.runLater(future);
try {
future.get();
} catch (ExecutionException e) {
throw propagateException(e.getCause());
} catch (InterruptedException e) {
throw propagateException(e);
}
}
use of netscape.javascript.JSObject in project intellij-plugins by StepicOrg.
the class StudyBrowserWindow method initConsoleListener.
private void initConsoleListener() {
engine.getLoadWorker().stateProperty().addListener((observable, oldValue, newValue) -> {
if (newValue != Worker.State.SUCCEEDED) {
return;
}
JSObject window = (JSObject) engine.executeScript("window");
window.setMember("java", bridge);
@Language("JavaScript") String script = "console.error = function (message) {\n" + " java.error(message);\n" + "};\n" + "console.warn = function (message) {\n" + " java.warn(message);\n" + "};\n" + "console.log = function (message) {\n" + " java.log(message);\n" + "};\n" + "console.debug = function (message) {\n" + " java.debug(message);\n" + "};\n" + "window.addEventListener('error', function (e) {\n" + " java.doError(e.filename, e.lineno, e.colno, e.message);\n" + " return true;\n" + "});";
engine.executeScript(script);
});
}
use of netscape.javascript.JSObject in project processdash by dtuma.
the class NSSelectField method getOptionValue.
private static String getOptionValue(JSObject formOptions, int idx) {
JSObject option = (JSObject) formOptions.getSlot(idx);
String result = (String) option.getMember("value");
if (result == null || result.trim().length() == 0) {
result = (String) option.getMember("text");
if (result != null)
result = result.trim();
}
return result;
}
Aggregations