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:com.googlecode.gflot.client.options.CategoriesAxisOptions.java

License:Open Source License

/**
 * Set the categories as an array.// w w  w.ja v a  2  s.  co m
 */
public final CategoriesAxisOptions setCategories(String... categories) {
    assert null != categories : "categories can't be null";

    JsArrayString array = JavaScriptObject.createArray().cast();
    for (String category : categories) {
        array.push(category);
    }
    return setCategories(array);
}

From source file:com.googlecode.gflot.client.options.CategoriesAxisOptions.java

License:Open Source License

/**
 * Set the categories as an array.// w ww. j a va2  s.  c o m
 */
public final CategoriesAxisOptions setCategories(Collection<String> categories) {
    assert null != categories : "categories can't be null";

    JsArrayString array = JavaScriptObject.createArray().cast();
    for (String category : categories) {
        array.push(category);
    }
    return setCategories(array);
}

From source file:com.googlecode.gflot.client.options.CommonSeriesOptions.java

License:Open Source License

/**
 * Set the threshold options.//www . j ava 2s  . c  o m
 *
 * @return this instance of {@link CommonSeriesOptions}
 */
public final T setThreshold(Threshold threshold) {
    JsArray<Threshold> array = JavaScriptObject.createArray().cast();
    array.push(threshold);
    return setThreshold(array);
}

From source file:com.googlecode.gflot.client.options.GridOptions.java

License:Open Source License

/**
 * Set the background color inside the grid area as a gradient.
 *//*from w  w  w  . j  a va  2  s .  c  o m*/
public final GridOptions setBackgroundColor(String fromColor, String toColor) {
    JsArrayString array = getBackgroundColorAsArray();
    if (null == array) {
        JsonObject jsonObject = JavaScriptObject.createObject().cast();
        array = JavaScriptObject.createArray().cast();
        jsonObject.put(BACKGROUND_COLORS_KEY, array);
        put(BACKGROUND_COLOR_KEY, jsonObject);
    }
    array.set(0, fromColor);
    array.set(1, toColor);
    return this;
}

From source file:com.googlecode.gflot.client.options.LegendOptions.java

License:Open Source License

/**
 * Set the distance to the plot edge//from  www.  j a va2s . c  o m
 */
public final LegendOptions setMargin(double marginX, double marginY) {
    JsArrayNumber array = getMarginAsArray();
    if (null == array) {
        array = JavaScriptObject.createArray().cast();
        put(MARGIN_KEY, array);
    }
    array.set(0, marginX);
    array.set(1, marginY);
    return this;
}

From source file:com.googlecode.gflot.client.options.Markings.java

License:Open Source License

/**
 * Creates a {@link Markings}
 */
public static final Markings create() {
    return JavaScriptObject.createArray().cast();
}

From source file:com.googlecode.gflot.client.options.SeriesGradient.java

License:Open Source License

/**
 * Creates a {@link SeriesGradient} with specified gradient
 *//*from   www .  jav  a  2s.c  o m*/
public static SeriesGradient of(Double fromOpacity, Double fromBrightness, Double toOpacity,
        Double toBrightness) {
    SeriesGradient gradient = JavaScriptObject.createObject().cast();
    JsArray<Gradient> array = JavaScriptObject.createArray().cast();
    array.push(Gradient.of(fromOpacity, fromBrightness));
    array.push(Gradient.of(toOpacity, toBrightness));
    gradient.put(FILL_COLOR_COLORS_KEY, array);
    return gradient;
}

From source file:com.googlecode.gflot.client.options.TimeSeriesAxisOptions.java

License:Open Source License

/**
 * Set the label used for month./*from   w w w .ja v  a2s .c  om*/
 */
public final TimeSeriesAxisOptions setMonthNames(String... monthNames) {
    assert null != monthNames : "monthNames can't be null";
    assert monthNames.length == 12 : "monthNames must have all 12 month names";

    JsArrayString array = JavaScriptObject.createArray().cast();
    for (String monthName : monthNames) {
        array.push(monthName);
    }
    return setMonthNames(array);
}

From source file:com.googlecode.gflot.client.options.TimeSeriesAxisOptions.java

License:Open Source License

/**
 * Set the label used for month./*w ww  .  j a  v  a 2 s  . c o  m*/
 */
public final TimeSeriesAxisOptions setMonthNames(Collection<String> monthNames) {
    assert null != monthNames : "monthNames can't be null";
    assert monthNames.size() == 12 : "monthNames must have all 12 month names";

    JsArrayString array = JavaScriptObject.createArray().cast();
    for (String monthName : monthNames) {
        array.push(monthName);
    }
    return setMonthNames(array);
}

From source file:com.googlecode.gflot.client.options.TimeSeriesAxisOptions.java

License:Open Source License

/**
 * Set the label used for days.//w w  w .  jav a2 s  .  c  o m
 */
public final TimeSeriesAxisOptions setDayNames(String... dayNames) {
    assert null != dayNames : "dayNames can't be null";
    assert dayNames.length == 7 : "dayNames must have all 7 days names";

    JsArrayString array = JavaScriptObject.createArray().cast();
    for (String dayName : dayNames) {
        array.push(dayName);
    }
    return setDayNames(array);
}