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:org.lirazs.gbackbone.client.core.js.JsArray.java

License:Apache License

public static <T> JsArray<T> create() {
    return JavaScriptObject.createArray().cast();
}

From source file:org.moxieapps.gwt.highcharts.client.YAxis.java

License:Apache License

/**
 * Sets category names to use for the xAxis (instead of using numbers), explicitly controlling whether
 * or not the axis will be redrawn in the case that the chart has already been rendered to the DOM.
 * If categories are present for the xAxis, names are used instead of numbers for that axis.
 * Example: setCategories("Apples", "Bananas", "Oranges"). Defaults to an empty array, which will
 * use numbers for the categories instead of names when categories are present.
 * <p/>/*w  ww . ja  v a 2  s  .com*/
 *
 * @param redraw     Whether to redraw the axis or wait for an explicit call to {@link org.moxieapps.gwt.highcharts.client.BaseChart#redraw()}
 * @param categories An array of category names to use for the axis.
 * @return A reference to this {@link XAxis} instance for convenient method chaining.
 * @since 1.1.1
 */
public YAxis setCategories(boolean redraw, String... categories) {
    final JavaScriptObject nativeAxis = getNativeAxis();
    if (nativeAxis != null) {
        JsArrayString jsArray = JavaScriptObject.createArray().<JsArrayString>cast();
        for (int i = 0; i < categories.length; i++) {
            String category = categories[i];
            jsArray.set(i, category);
        }
        nativeSetCategories(nativeAxis, jsArray, redraw);
        return this;
    } else {
        return this.setOption("categories", categories);
    }
}

From source file:org.nsesa.editor.gwt.core.client.ui.rte.ckeditor.CKEditorToolbar.java

License:EUPL

/**
 * Creates a Javascript toolbar representation based on the list of the available toolbar lines
 * @return an array as JavaScriptObject/*from   w ww  .  j av  a2  s. c om*/
 */
public JavaScriptObject getRepresentation() {
    JavaScriptObject array = JavaScriptObject.createArray();
    for (ToolbarLine line : lines) {
        JavaScriptObject representation = line.getRepresentation();
        array = addToArray(array, representation);
    }
    return array;
}

From source file:org.obiba.opal.web.gwt.app.client.administration.index.view.IndexAdministrationView.java

License:Open Source License

@SuppressWarnings("unchecked")
@Override//from  w w w . j a  v  a 2 s. com
public void clear() {
    renderRows((JsArray<TableIndexStatusDto>) JavaScriptObject.createArray());
    checkboxColumn.clearSelection();
    selectAllAlert.setVisible(false);
}

From source file:org.obiba.opal.web.gwt.app.client.js.JsArrays.java

License:Open Source License

/**
 * Concatenates the provided arrays into a newly constructed array. Returns the new array.
 *//*from  w  ww  .j  ava2s. co m*/
public static <T extends JavaScriptObject> JsArray<T> concat(JsArray<T>... arrays) {
    JsArray<T> concat = JavaScriptObject.createArray().cast();
    return pushAll(concat, arrays);
}

From source file:org.obiba.opal.web.gwt.app.client.js.JsArrays.java

License:Open Source License

@SuppressWarnings("unchecked")
public static <T extends JavaScriptObject> JsArray<T> create() {
    return (JsArray<T>) JavaScriptObject.createArray();
}

From source file:org.obiba.opal.web.gwt.app.client.js.JsArrays.java

License:Open Source License

public static JsArrayString toSafeArray(JsArrayString array) {
    return array == null ? (JsArrayString) JavaScriptObject.createArray() : array;
}

From source file:org.obiba.opal.web.gwt.app.client.magma.copydata.presenter.DataCopyPresenter.java

License:Open Source License

private CopyCommandOptionsDto createCopyCommandOptions(String destination, String newName) {
    CopyCommandOptionsDto dto = CopyCommandOptionsDto.create();

    JsArrayString selectedTables = JavaScriptObject.createArray().cast();

    for (TableDto exportTable : copyTables) {
        selectedTables.push(exportTable.getDatasourceName() + "." + exportTable.getName());
    }//from  ww  w.  ja v a2s  . c  om

    dto.setTablesArray(selectedTables);
    dto.setDestination(destination);
    dto.setDestinationTableName(newName);
    dto.setNonIncremental(!getView().isIncremental());
    dto.setCopyNullValues(getView().isCopyNullValues());
    dto.setNoVariables(!getView().isWithVariables());
    if (!Strings.isNullOrEmpty(valuesQuery) && getView().applyQuery()) {
        dto.setQuery(valuesQuery);
    }

    return dto;
}

From source file:org.obiba.opal.web.gwt.app.client.magma.derive.helper.DerivedVariableGenerator.java

License:Open Source License

@SuppressWarnings("unchecked")
public VariableDto generate(@Nullable VariableDto destination) {
    // Copy variable in both case because the user could click on Cancel
    VariableDto derived = destination == null ? copyVariable(originalVariable)
            : copyVariable(destination, true, originalVariable.getLink());

    scriptBuilder = new StringBuilder();
    newCategoriesMap.clear();//from   w w  w.  j a va  2 s.c  o  m

    // don't overwrite value type if destination variable exists
    if (destination == null || derived.getValueType() == null) {
        derived.setValueType("text");
    }

    generateScript();

    // set script in derived variable
    VariableDtos.setScript(derived, scriptBuilder.toString());

    // set new categories if destination does not already exist
    if (destination == null) {
        if (derived.getCategoriesArray() == null) {
            derived.setCategoriesArray((JsArray<CategoryDto>) JavaScriptObject.createArray());
        }
        for (CategoryDto cat : newCategoriesMap.values()) {
            derived.getCategoriesArray().push(cat);
        }
    }

    return derived;
}

From source file:org.obiba.opal.web.gwt.app.client.magma.exportdata.presenter.DataExportPresenter.java

License:Open Source License

private ExportCommandOptionsDto createExportCommandOptions(String fileFormat, String outFile,
        String idMapping) {/*from  ww w .ja v a2s  .c  om*/
    ExportCommandOptionsDto dto = ExportCommandOptionsDto.create();

    JsArrayString selectedTables = JavaScriptObject.createArray().cast();

    for (TableDto exportTable : exportTables) {
        selectedTables.push(exportTable.getDatasourceName() + "." + exportTable.getName());
    }

    dto.setTablesArray(selectedTables);
    dto.setFormat(fileFormat);
    dto.setOut(outFile);
    dto.setNonIncremental(true);
    dto.setNoVariables(false);
    if (idMapping != null) {
        IdentifiersMappingConfigDto idConfig = IdentifiersMappingConfigDto.create();
        idConfig.setName(idMapping);
        idConfig.setAllowIdentifierGeneration(false);
        idConfig.setIgnoreUnknownIdentifier(false);
        dto.setIdConfig(idConfig);
    }
    if (!Strings.isNullOrEmpty(valuesQuery) && getView().applyQuery()) {
        dto.setQuery(valuesQuery);
    }

    return dto;
}