Example usage for com.google.gwt.core.client JsArrayString push

List of usage examples for com.google.gwt.core.client JsArrayString push

Introduction

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

Prototype

public final native void push(String value) ;

Source Link

Document

Pushes the given value onto the end of the array.

Usage

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) {/*from   w ww .  j av  a  2 s .  co m*/

    /**
     * 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.kune.polymer.client.PolymerUtils.java

License:GNU Affero Public License

/**
 * https://stackoverflow.com/questions/22167486/gwt-how-to-pass-java-array-
 * into-javascript-native-method//www.  ja v a 2s .c  o m
 */
private static JsArrayString toJsArray(final String[] input) {
    final JsArrayString jsArrayString = JsArrayString.createArray().cast();
    for (final String s : input) {
        jsArrayString.push(s);
    }
    return jsArrayString;
}

From source file:ch.takoyaki.email.html.client.utils.StringFormatter.java

License:Open Source License

public static String format(final String format, final Object... args) {
    if (null == args || 0 == args.length)
        return format;
    JsArrayString array = newArray();
    for (Object arg : args) {
        array.push(String.valueOf(arg)); // TODO: smarter conversion?
    }/*from  ww w . j  a v a2  s  .c om*/
    return nativeFormat(format, array);
}

From source file:com.ait.ext4j.client.chart.axis.AbstractAxis.java

License:Apache License

/**
 * The fields of model to bind to this axis.
 * /*from  w  w w  . ja va2  s  .c  om*/
 * For example if you have a data set of lap times per car, each having the
 * fields: 'carName', 'avgSpeed', 'maxSpeed'. Then you might want to show
 * the data on chart with ['carName'] on Name axis and ['avgSpeed',
 * 'maxSpeed'] on Speed axis.
 * 
 * @param fields
 */
public void setFields(ArrayList<String> fields) {
    JsArrayString array = JsArrayString.createArray().cast();
    for (String string : fields) {
        array.push(string);
    }
    JsoHelper.setAttribute(jsObj, "fields", array);
}

From source file:com.ait.ext4j.client.chart.axis.AbstractAxis.java

License:Apache License

/**
 * The fields of model to bind to this axis.
 * /*from   ww w . j a  va  2 s  .c o m*/
 * For example if you have a data set of lap times per car, each having the
 * fields: 'carName', 'avgSpeed', 'maxSpeed'. Then you might want to show
 * the data on chart with ['carName'] on Name axis and ['avgSpeed',
 * 'maxSpeed'] on Speed axis.
 * 
 * @param fields
 */
public void setFields(String... fields) {
    JsArrayString array = JsArrayString.createArray().cast();
    for (String string : fields) {
        array.push(string);
    }
    JsoHelper.setAttribute(jsObj, "fields", array);
}

From source file:com.ait.ext4j.client.chart.series.AbstractSerie.java

License:Apache License

public void setAxis(String... fields) {
    JsArrayString array = JsArrayString.createArray().cast();
    for (String string : fields) {
        array.push(string);
    }/* w  ww .j a v a  2  s . c  o m*/
    JsoHelper.setAttribute(jsObj, "axis", array);
}

From source file:com.ait.ext4j.client.chart.series.AbstractSerie.java

License:Apache License

public void setAxis(Position... positions) {
    JsArrayString array = JsArrayString.createArray().cast();
    for (Position p : positions) {
        array.push(p.getValue());
    }/*from   www.  ja  v  a 2 s .  c  o  m*/
    JsoHelper.setAttribute(jsObj, "axis", array);
}

From source file:com.ait.ext4j.client.chart.series.CartesianSerie.java

License:Apache License

public void setXField(String... fields) {
    JsArrayString array = JsArrayString.createArray().cast();
    for (String string : fields) {
        array.push(string);
    }//from  w w  w.ja  v  a2 s.  c  o m
    JsoHelper.setAttribute(jsObj, "xField", array);
}

From source file:com.ait.ext4j.client.chart.series.CartesianSerie.java

License:Apache License

public void setYField(String... fields) {
    JsArrayString array = JsArrayString.createArray().cast();
    for (String string : fields) {
        array.push(string);
    }/*from  w  w  w .  ja v a2 s.  c om*/
    JsoHelper.setAttribute(jsObj, "yField", array);
}

From source file:com.ait.ext4j.client.chart.theme.Theme.java

License:Apache License

public static void defineTheme(String themeName, String baseColor, List<String> colors) {
    JsArrayString values = JsArray.createArray().cast();
    for (String s : colors) {
        values.push(s);
    }// w w  w . j a v  a2  s. co  m
    defineTheme(themeName, baseColor, values);
}