Package org.mozilla.javascript

Examples of org.mozilla.javascript.NativeArray


                    }
                }
            }
            return ht;
        } else if (arg instanceof NativeArray) {
            NativeArray na = (NativeArray) arg;
            Number n = (Number) na.get("length", na);
            int l = n.intValue();
            Vector retval = new Vector(l);
            for (int i=0; i<l; i++) {
                retval.add(i, processXmlRpcResponse(na.get(i, na)));
            }
            return retval;
        } else if (arg instanceof Map) {
            Map map = (Map) arg;
            Hashtable ht = new Hashtable(map.size()*2);
 
View Full Code Here


        } else if (items.size()==1 && !isMulti) {
            return items.iterator().next();

        } else {
            NativeArray result = new NativeArray(items.toArray());
            ScriptRuntime.setObjectProtoAndParent(result, this);
            return result;
        }
    }
View Full Code Here

   
    Emmet jse = Emmet.getSingleton();
    Scriptable tabstopData = (Scriptable) jse.execJSFunction("javaExtractTabstops", text);
    if (tabstopData != null) {
      text = Context.toString(ScriptableObject.getProperty(tabstopData, "text"));
      NativeArray tabstops = (NativeArray) ScriptableObject.getProperty(tabstopData, "tabstops");
      NativeObject tabstopItem;
      for (int i = 0; i < tabstops.getLength(); i++) {
        tabstopItem = (NativeObject) ScriptableObject.getProperty(tabstops, i);
        addTabStopToGroup(
            Context.toString(ScriptableObject.getProperty(tabstopItem, "group")),
            (int) Context.toNumber(ScriptableObject.getProperty(tabstopItem, "start")),
            (int) Context.toNumber(ScriptableObject.getProperty(tabstopItem, "end")));
View Full Code Here

        TestsResult result = new TestsResult();

        executeTimer();

        ScriptResult scriptResult = page.executeJavaScript("window.simulationContext.results");
        NativeArray array = (NativeArray) scriptResult.getJavaScriptResult();

        for (int i = 0; i < array.getLength(); i++) {
            NativeObject object = (NativeObject) array.get(i, array);
            String data = null;
            Object dataObject = object.get("data", object);

            if (!(dataObject instanceof Undefined)) {
                data = (String) dataObject;
View Full Code Here

            cl.clear();
            cl.addAll(java.util.Arrays.asList(values));
        } else if (property instanceof NativeArray) {
            Context.enter();
            try {
                NativeArray arr = (NativeArray) property;

                ScriptableObject.putProperty(arr, "length", new Integer(0));
                ScriptableObject.putProperty(arr, "length",
                                             new Integer(values.length));
                for (int i = 0; i<values.length; i++) {
View Full Code Here

        }
        Object result = jxcontext_.getValue(xpath);

        if (result instanceof NativeArray) {
            // Convert JavaScript array to Collection
            NativeArray arr = (NativeArray) result;
            int len = (int) arr.jsGet_length();
            List list = new ArrayList(len);

            for (int i = 0; i<len; i++) {
                Object obj = arr.get(i, arr);

                if (obj==Context.getUndefinedValue()) {
                    obj = null;
                }
                list.add(obj);
View Full Code Here

            cl.clear();
            cl.addAll(java.util.Arrays.asList(values));
        } else if (property instanceof NativeArray) {
            Context.enter();
            try {
                NativeArray arr = (NativeArray) property;

                ScriptableObject.putProperty(arr, "length", new Integer(0));
                ScriptableObject.putProperty(arr, "length",
                                             new Integer(values.length));
                for (int i = 0; i<values.length; i++) {
View Full Code Here

        }
        Object result = jxcontext_.getValue(xpath);

        if (result instanceof NativeArray) {
            // Convert JavaScript array to Collection
            NativeArray arr = (NativeArray) result;
            int len = (int) arr.jsGet_length();
            List list = new ArrayList(len);

            for (int i = 0; i<len; i++) {
                Object obj = arr.get(i, arr);

                if (obj==Context.getUndefinedValue()) {
                    obj = null;
                }
                list.add(obj);
View Full Code Here

    }

    public Object getValue() {
        Object val = getNode();
        if (val instanceof NativeArray) {
            NativeArray arr = (NativeArray)val;
            List list = new LinkedList();
            int len = (int)arr.jsGet_length();
            for (int i = 0; i < len; i++) {
                Object obj = arr.get(i, arr);
                if (obj == Undefined.instance) {
                    obj = null;
                }
                list.add(obj);
            }
View Full Code Here

                    getDebugger().setVisible(true);
                }
            }
            int size = (params != null ? params.size() : 0);
            Object[] funArgs = new Object[size];
            NativeArray parameters = new NativeArray(size);
            if (size != 0) {
                for (int i = 0; i < size; i++) {
                    Interpreter.Argument arg = (Interpreter.Argument)params.get(i);
                    funArgs[i] = arg.value;
                    if (arg.name == null) arg.name = "";
                    parameters.put(arg.name, parameters, arg.value);
                }
            }
            cocoon.setParameters(parameters);
            NativeArray funArgsArray = new NativeArray(funArgs);
            Object fun = ScriptableObject.getProperty(thrScope, funName);
            if (fun == Scriptable.NOT_FOUND) {
                fun = funName; // this will produce a better error message
            }
            Object callFunArgs[] = { fun, funArgsArray };
View Full Code Here

TOP

Related Classes of org.mozilla.javascript.NativeArray

Copyright © 2018 www.massapicom. 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.