Java Code Examples for netscape.javascript.JSObject#call()

The following examples show how to use netscape.javascript.JSObject#call() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TextEditorPane.java    From logbook-kai with MIT License 6 votes vote down vote up
private void setting() {
    WebEngine engine = this.webview.getEngine();
    JSObject window = (JSObject) engine.executeScript("window");
    Object ace = null;
    try {
        ace = engine.executeScript("ace");
    } catch (Exception e) {
    }
    if (ace != null && ace != engine.executeScript("undefined")) {
        if (this.lang != null) {
            window.call("start", this.lang);
            this.lang = null;
        }
        if (this.source != null) {
            window.call("set", this.source);
            this.source = null;
        }
        if (this.readOnly != null) {
            window.call("setReadOnly", this.readOnly);
            this.readOnly = null;
        }
    }
}
 
Example 2
Source File: AbstractWizard.java    From netbeans with Apache License 2.0 5 votes vote down vote up
final Object evaluateCall(final Object fn, final Object p) throws InterruptedException, ExecutionException {
    FutureTask<?> t = new FutureTask<Object>(new Callable<Object>() {
        @Override
        public Object call() throws Exception {
            JSObject jsRegFn = (JSObject) fn;
            return jsRegFn.call("call", null, p);
        }
    });
    ctx.execute(t);
    return t.get();
}
 
Example 3
Source File: ShipmentScaleApplet.java    From scipio-erp with Apache License 2.0 4 votes vote down vote up
private void setWeight(String weight) {
    JSObject win = JSObject.getWindow(this);
    String[] args = { weight };
    win.call("setWeight", args);
}
 
Example 4
Source File: ArrayTester.java    From GMapsFX with Apache License 2.0 2 votes vote down vote up
private void runTests() {
    
    JSObject jsWin = (JSObject) webengine.executeScript("window");
    jsWin.call("displayTest", new Object[]{null});
    
    JavascriptArray ary = new JavascriptArray();
    
    int len = 0;
    for (int i = 0; i < 6; i++) {
        len = ary.push("String " + i);
        LOG.debug("testArrays push " + i + " gives len: " + len);
    }
    
    LOG.debug("testArrays toString: " + ary.toString());
    
    ary.reverse();
    
    LOG.debug("testArrays reverse toString: " + ary.toString());
    
    ary.reverse();
    
    Object obj = ary.pop();
    
    LOG.debug("testArrays popped: " + obj);
    LOG.debug("testArrays popped toString: " + ary.toString());
    
    TestJSO jso = new TestJSO();
    jso.setTestName("Test 1");
    
    ary.unshift(jso);
    
    LOG.debug("testArrays unshift JsO toString: " + ary.toString());
    
    Object jso1 = ary.shift();
    
    LOG.debug("testArrays shift JsO: " + jso1);
    LOG.debug("testArrays shift JsO reference equality: " + (jso == jso1));
    LOG.debug("testArrays shift JsO toString: " + ary.toString());
    
    ary.push(jso);
    LOG.debug("testArrays push JsO toString: " + ary.toString());
    
    jsWin.call("displayArray", ary);
    
    jso.setTestName("Altered Test 1");
    
    jsWin.call("displayArray", ary);
    
    LOG.debug("testArrays alter JsO toString: " + ary.toString());
    
    Object jso2 = ary.get(ary.length() - 1);
    LOG.debug("testArrays get JsO2: " + jso2);
    
    jsWin.call("iterateArray", ary);
    
    jsWin.call("displayTestEnd", new Object[]{null});
    
}