Example usage for com.google.gwt.core.client JavaScriptObject createArray

List of usage examples for com.google.gwt.core.client JavaScriptObject createArray

Introduction

In this page you can find the example usage for com.google.gwt.core.client JavaScriptObject createArray.

Prototype

public static native JavaScriptObject createArray() ;

Source Link

Document

Returns a new array.

Usage

From source file:app.service.JSInvoker.java

License:GNU General Public License

private static JsArray<JavaScriptObject> _wrap(Object[] o) {
    JsArray<JavaScriptObject> a = JavaScriptObject.createArray().cast();
    for (Object i : o)
        a.push(wrap(i));//from   w  ww.  j  ava  2  s . c o  m

    return a;
}

From source file:ar.com.macsgroup.graphics.gwtraphael.client.charts.pie.PieChart.java

License:Open Source License

public void drawInside(Widget widget, Integer[] values, LegendPosition legendPosition, String[] legends,
        String[] colors) {/*ww  w  . j a  v a  2s. c om*/

    /**
     * Converting numbers
     */
    JsArrayNumber valuesJs = (JsArrayNumber) JavaScriptObject.createArray();

    for (int value : values) {
        valuesJs.push(value);
    }

    /**
     * Converting legends
     */
    JsArrayString legendsJs = (JsArrayString) JavaScriptObject.createArray();

    for (String value : legends) {
        legendsJs.push(value);
    }

    /**
     * Converting colors
     */
    JsArrayString colorJs = (JsArrayString) JavaScriptObject.createArray();

    if (colors != null) {
        for (String value : colors) {
            colorJs.push(value);
        }
    }

    draw(widget.getElement(), this.width, this.height, this.font, this.title, valuesJs,
            legendPosition.getRaphaelString(), legendsJs, colorJs);
}

From source file:cc.alcina.framework.gwt.client.util.ClientUtils.java

License:Apache License

public static <T extends JavaScriptObject> JsArray<T> toTypedJsArray(List<T> value) {
    JsArray<T> array = JavaScriptObject.createArray().cast();
    for (T t : value) {
        array.push(t);/*from   w  w w .  ja  v  a  2s  .  c  o m*/
    }
    return array;
}

From source file:cn.mapway.document.ui.client.component.ace.AceCompletionCallbackImpl.java

License:Open Source License

@Override
public void invokeWithCompletions(AceCompletion[] proposals) {
    JsArray<JavaScriptObject> jsProposals = JavaScriptObject.createArray().cast();
    for (AceCompletion proposal : proposals) {
        jsProposals.push(proposal.toJsObject());
    }//from   ww w. ja va 2  s.c  o  m
    doInvokeWithCompletions(jsProposals);
}

From source file:cn.mapway.document.ui.client.component.ace.AceEditor.java

License:Open Source License

/**
 * Reset any annotations in the local <code>annotations</code> JsArray<AceAnnotation>
 *///from  w w  w  .jav  a2 s  . c o m
private void resetAnnotations() {
    annotations = JavaScriptObject.createArray().cast();
}

From source file:com.ait.lienzo.client.core.types.NBaseNativeArrayJSO.java

License:Open Source License

public static NBaseNativeArrayJSO<?> make() {
    return JavaScriptObject.createArray().cast();
}

From source file:com.ait.tooling.nativetools.client.NArrayBaseJSO.java

License:Open Source License

protected static final <T extends NArrayBaseJSO<T>> T createNArrayBaseJSO() {
    return JavaScriptObject.createArray().cast();
}

From source file:com.ait.toolkit.editors.ckeditor.client.Toolbar.java

License:Open Source License

public JavaScriptObject getRepresentation() {
    JavaScriptObject array = JavaScriptObject.createArray();
    for (ToolbarLine line : lines) {
        Object representation = line.getRepresentation();
        if (representation instanceof JavaScriptObject)
            array = addToArray(array, (JavaScriptObject) representation);
        else/*from  w  w  w .  j a v a 2  s  . co m*/
            array = addToArray(array, (String) representation);
    }
    return array;
}

From source file:com.ait.toolkit.editors.ckeditor.client.ToolbarLine.java

License:Open Source License

public Object getRepresentation() {
    if (type == LINE_TYPE.SEPARATOR) {
        return getSeparator();
    } else {/*  w  w  w.  ja  v a  2 s. c om*/
        JavaScriptObject array = JavaScriptObject.createArray();
        for (TOOLBAR_OPTIONS opt : blocks) {
            if (opt == TOOLBAR_OPTIONS._)
                array = addToArray(array, "-");
            else
                array = addToArray(array, opt.toString());
        }
        return array;
    }
}

From source file:com.ait.toolkit.node.core.JavaScriptUtils.java

License:Open Source License

public static JsArrayInteger toIntegerArray(byte... bytes) {
    JsArrayInteger ret = JavaScriptObject.createArray().cast();
    for (byte byt : bytes) {
        ret.push(byt);//from   w ww . ja v  a2  s.c om
    }
    return ret;
}