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.TimeSeriesAxisOptions.java

License:Open Source License

/**
 * Set the label used for days.//from  w  w  w  .ja va  2 s. co m
 */
public final TimeSeriesAxisOptions setDayNames(Collection<String> dayNames) {
    assert null != dayNames : "dayNames can't be null";
    assert dayNames.size() == 7 : "dayNames must have all 7 days names";

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

From source file:com.googlecode.gflot.client.PlotModel.java

License:Open Source License

public JsArray<Series> getSeries() {
    JsArray<Series> seriesArray = JavaScriptObject.createArray().cast();
    for (SeriesHandler handler : handlers) {
        seriesArray.push(handler.getSeries());
    }//from   w  w  w.jav a2  s .c om
    return seriesArray;
}

From source file:com.googlecode.gflot.client.Tick.java

License:Open Source License

/**
 * Creates a {@link Tick}/*from w w w  .  j a  v  a2s.c  o m*/
 */
public static Tick of(double value, String label) {
    Tick tick = JavaScriptObject.createArray().cast();
    tick.push(value);
    tick.push(label);
    return tick;
}

From source file:com.googlecode.gflot.examples.client.examples.fillArea.FillAreaExample.java

License:Open Source License

/**
 * Create plot//from ww w. ja  v  a 2s.  co  m
 */
@Override
@GFlotExamplesSource
public Widget createPlot() {
    PlotModel model = new PlotModel();

    PlotOptions plotOptions = PlotOptions.create();
    plotOptions.setLegendOptions(LegendOptions.create().setShow(false));
    plotOptions.addYAxisOptions(AxisOptions.create().setShow(true));
    plotOptions.addXAxisOptions(AxisOptions.create().setShow(true));
    plotOptions.setZoomOptions(ZoomOptions.create().setInteractive(true));
    plotOptions.setPanOptions(PanOptions.create().setInteractive(true));

    JsArray<LevelInfo> levels = JavaScriptObject.createArray().cast();
    levels.push(LevelInfo.of(LevelInfo.LevelRepresentation.ASYMMETRIC).setColor("red"));
    levels.push(LevelInfo.of(LevelInfo.LevelRepresentation.SYMMETRIC).setColor("green"));

    // create a series
    final SeriesHandler vancouverSeries = model.addSeries(Series.of("Vancouver").setFillArea(levels)
            .setLineSeriesOptions(LineSeriesOptions.create().setShow(true).setSteps(true)));

    // add data
    for (int i = 0; i < 10; i++) {
        double x = i + 10.0;
        double y = i * 0.5;
        vancouverSeries.add(DataPoint.of(x, y, y - 10.0, y + 15.0, 20));
    }

    // create the plot
    plot = new SimplePlot(model, plotOptions);

    return binder.createAndBindUi(this);
}

From source file:com.googlecode.gwt.charts.client.controls.Dashboard.java

License:Apache License

/**
 * Binds one or more Controls to one or more other dashboard participants (either charts or other controls), so
 * that all of the latter are redrawn whenever any of the former collects a programmatic or user interaction that
 * affects the data managed by the dashboard. Returns the dashboard instance itself for chaining multiple bind()
 * calls together./*from ww  w.  j  av a  2 s .  c o m*/
 * 
 * @param controlWrappers todo
 * @param chartWrappers todo
 */
public void bind(List<ControlWrapper<?, ?>> controlWrappers, List<ChartWrapper<?>> chartWrappers) {
    JsArray<ControlWrapperObject<?, ?>> controlWrapperArray = JavaScriptObject.createArray().cast();
    for (ControlWrapper<?, ?> controlWrapper : controlWrappers) {
        controlWrapperArray.push(controlWrapper.getObject());
    }
    JsArray<ChartWrapperObject<?>> chartWrapperArray = JavaScriptObject.createArray().cast();
    for (ChartWrapper<?> chartWrapper : chartWrappers) {
        chartWrapperArray.push(chartWrapper.getObject());
    }
    dashboardObject.bind(controlWrapperArray, chartWrapperArray);
}

From source file:com.googlecode.gwt.charts.client.util.ChartHelper.java

License:Apache License

/**
 * This method takes in a 2-dimensional array and converts it to a DataTable.
 * //ww  w  . ja v a2s  .  c  o m
 * @param array A two-dimensional array, where each row represents a row in the data table.<br>
 *        The data types of each column are interpreted automatically from the data given.<br>
 *        If a cell has no value, specify a null or empty value as appropriate.
 * @param firstRowIsData if true, all rows are assumed to be data.
 * @return a new DataTable.
 */
public static final DataTable arrayToDataTable(Object[][] array, boolean firstRowIsData) {
    JsArrayMixed jsTopArray = JavaScriptObject.createArray().cast();
    for (Object[] objects : array) {
        jsTopArray.push(ArrayHelper.createArray(objects));
    }
    return arrayToDataTable(jsTopArray, firstRowIsData);
}

From source file:com.googlecode.gwtphonegap.collection.client.JsLightArray.java

License:Apache License

public JsLightArray() {
    this(JavaScriptObject.createArray());
}

From source file:com.googlecode.gwtphonegap.collection.client.JsLightArrayBoolean.java

License:Apache License

public JsLightArrayBoolean() {
    this(JavaScriptObject.createArray());
}

From source file:com.googlecode.gwtphonegap.collection.client.JsLightArrayInteger.java

License:Apache License

public JsLightArrayInteger() {
    this(JavaScriptObject.createArray());
}

From source file:com.gwtm.ui.client.core.transforms.element.TransformCommitScheduler.java

License:Apache License

private static JsArray<CommitTask> createJsQueue() {
    return JavaScriptObject.createArray().cast();
}