Example usage for com.google.gwt.core.client JsArrayBoolean length

List of usage examples for com.google.gwt.core.client JsArrayBoolean length

Introduction

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

Prototype

public final native int length() ;

Source Link

Document

Gets the length of the array.

Usage

From source file:nz.co.doltech.gwtjui.core.client.js.JsArrayUtil.java

License:Apache License

public static List<Boolean> toList(JsArrayBoolean array) {
    List<Boolean> list = new ArrayList<>();
    if (array != null) {
        for (int i = 0; i < array.length(); i++) {
            list.add(array.get(i));/*w w w .  jav  a  2 s. com*/
        }
    }
    return list;
}

From source file:org.daxplore.presenter.client.json.shared.JsonTools.java

License:Open Source License

/**
 * Convert a {@link JsArrayBoolean} to a boolean array.
 * /*  ww w.  j a va 2 s.c o  m*/
 * @param jsArray
 *            the js array
 * @return the boolean[]
 */
public static boolean[] jsArrayAsArray(JsArrayBoolean jsArray) {
    boolean[] javaArray = new boolean[jsArray.length()];
    for (int i = 0; i < jsArray.length(); i++) {
        javaArray[i] = jsArray.get(i);
    }
    return javaArray;
}

From source file:org.daxplore.presenter.client.json.shared.JsonTools.java

License:Open Source License

/**
 * Convert a {@link JsArrayBoolean} to a List<Boolean>.
 * /*from  w ww  . j a  v  a 2  s  .co m*/
 * @param jsArray
 *            the js array
 * @return the list
 */
public static List<Boolean> jsArrayAsList(JsArrayBoolean jsArray) {
    List<Boolean> list = new LinkedList<Boolean>();
    for (int i = 0; i < jsArray.length(); i++) {
        list.add(jsArray.get(i));
    }
    return list;
}

From source file:org.turbogwt.core.collections.JsArrays.java

License:Apache License

public static boolean[] toArray(JsArrayBoolean values) {
    if (GWT.isScript()) {
        return reinterpretCast(values);
    } else {/*from w ww.  j a  v a 2s . c o  m*/
        int length = values.length();
        boolean[] ret = new boolean[length];
        for (int i = 0, l = length; i < l; i++) {
            ret[i] = values.get(i);
        }
        return ret;
    }
}