Package org.mozilla.javascript

Examples of org.mozilla.javascript.Function.call()


        Object functionArgs[] = {};
        Function f = (Function) fObj;

        // Execute our org_wso2_mashup_ConvertToString function and get the function a string
        Object args = f.call(engine.getCx(), engine, engine, functionArgs);
        String[] params = null;
        if (args instanceof String) {
            String functionString = (String) args;
            int paramStartIndex = functionString.indexOf('(');
            int paramEndIndex = functionString.indexOf(')');
View Full Code Here


            Object fObj = scope.get(methodName, scope);
            if (!(fObj instanceof Function)) {
                System.out.println("f is undefined or not a function.");
            } else {
                Function f = (Function)fObj;
                Object result = f.call(cx, scope, scope, args);
                String report = "f('my args') = " + Context.toString(result);
                System.out.println(report);
            }
        } finally {
            Context.exit();
View Full Code Here

            Object fObj = scope.get(methodName, scope);
            if (!(fObj instanceof Function)) {
                System.out.println("f is undefined or not a function.");
            } else {
                Function f = (Function)fObj;
                Object result = f.call(cx, scope, scope, args);
                //String report = "f('my args') = " + Context.toString(result);
                //System.out.println(report);
            }
        } finally {
            Context.exit();
View Full Code Here

                throw new AxisFault("Method " + method + " is undefined or not a function");
            }
            // Invokes the java script function

            Function f = (Function) fObj;
            return f.call(cx, this, this, functionArgs);
        } catch (WrappedException exception) {
            throw AxisFault.makeFault(exception.getCause());
        } catch (JavaScriptException exception) {
            throw new AxisFault(exception.getValue().toString(), exception);
        } catch (Throwable throwable) {
View Full Code Here

    public Object evaluateFunction(String func, Object[] args) {
        func = "var x = " + func + ";";
        this.cx.evaluateString(this, func, "Eval Func", 0, null);
        Function function = (Function) this.get("x", this);
        return function.call(this.cx, this, this, args);
    }

    /**
     * Evaluates the requested operation in the Javascript service
     * implementation. Any Javascript source defined under loadJSScripts
View Full Code Here

                Object[] args = new Object[1];
                Scriptable scope = getTopLevelScope(this);
                Scriptable thisObj = scope;
                Context cx = Context.getCurrentContext();
                args[0] = this;
                fun.call(cx, scope, thisObj, args);
            } catch (Exception exc) {
                throw Context.reportRuntimeError(exc.getMessage());
            }
        }
    }
View Full Code Here

                Object[] args = new Object[1];
                Scriptable scope = getTopLevelScope(this);
                Scriptable thisObj = scope;
                Context cx = Context.getCurrentContext();
                args[0] = this;
                fun.call(cx, scope, thisObj, args);
            } catch (Exception exc) {
                throw Context.reportRuntimeError(exc.getMessage());
            }
        }
    }
View Full Code Here

                Scriptable thisObj = scope;
                Context cx = Context.getCurrentContext();
                for (int i = 0; i < len; i++) {
                    ScriptableWidget row = wrap(repeater.getRow(i));
                    args[0] = row;
                    Object result = fun.call(cx, scope, thisObj, args);
                    index[i] = Context.toBoolean(result);
                }   
                for (int i = len-1; i >= 0; --i) {
                    if (index[i]) {
                        deleteRow(repeater, i);
View Full Code Here

                    Object[] args = new Object[1];
                    Scriptable scope = getTopLevelScope(this);
                    Scriptable thisObj = scope;
                    Context cx = Context.getCurrentContext();
                    args[0] = ((ActionEvent)e).getActionCommand();
                    fun.call(cx, scope, thisObj, args);
                } catch (Exception exc) {
                    throw Context.reportRuntimeError(exc.getMessage());
                }
            }
        } else if (e instanceof ValueChangedEvent) {
View Full Code Here

                    Scriptable scope = getTopLevelScope(this);
                    Scriptable thisObj = scope;
                    Context cx = Context.getCurrentContext();
                    args[0] = vce.getOldValue();
                    args[1] = vce.getNewValue();
                    fun.call(cx, scope, thisObj, args);
                } catch (Exception exc) {
                    throw Context.reportRuntimeError(exc.getMessage());
                }
            }
        }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.