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

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

Introduction

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

Prototype

public final native void set(int index, String value) ;

Source Link

Document

Sets the value value at a given index.

Usage

From source file:fr.lucboutier.gwt.webworker.client.WorkerGlobalScope.java

License:Apache License

public final void importScripts(String[] urls) {
    JsArrayString jsUrls = JsArrayString.createArray().cast();
    for (int i = 0, l = urls.length; i < l; ++i) {
        jsUrls.set(i, urls[i]);
    }//w w w. j av  a 2s.  c om
    importScripts(jsUrls);
}

From source file:org.cruxframework.crux.core.client.utils.JsUtils.java

License:Apache License

public static JsArrayString toJsArray(List<String> list) {
    JsArrayString js = JsArrayString.createArray().cast();
    for (int i = 0; i < list.size(); i++) {
        js.set(i, list.get(i));
    }/*  ww  w .  j a  v a  2  s  .c o m*/
    return js;
}

From source file:org.cruxframework.crux.core.client.utils.JsUtils.java

License:Apache License

public static JsArrayString toJsArray(String[] args) {
    JsArrayString js = JsArrayString.createArray().cast();
    for (int i = 0; i < args.length; i++) {
        js.set(i, args[i]);
    }//from   ww w .j a v  a  2s  .co m
    return js;
}

From source file:org.dataconservancy.dcs.access.client.model.JsProvDocument.java

License:Apache License

public JsArrayString getRelatedEntities(String entityId) {
    JsArrayString relatedEntities = JavaScriptObject.createArray().cast();
    JsArray<JsDerivedFrom> derivations = getDerivations();
    int i = 0;//from  w  w  w .jav  a 2  s  . com
    for (int k = 0; k < derivations.length(); k++) {
        if (derivations.get(k).getGeneratedEntity().equals(entityId)) {
            relatedEntities.set(i, derivations.get(k).getUsedEntity());
            i++;
        } else if (derivations.get(k).getUsedEntity().equals(entityId)) {
            relatedEntities.set(i, derivations.get(k).getGeneratedEntity());
            i++;
        }
    }

    return relatedEntities;
}

From source file:org.eurekastreams.web.client.ui.pages.master.ApplicationEntryPoint.java

License:Apache License

/**
 * Get the people from the server, convert them to JSON, and feed them back to the handler.
 *
 * @param ntids/*from  www. ja v  a 2 s .c  o m*/
 *            the ntids.
 * @param callbackIndex
 *            the callback index.
 */
public static void bulkGetPeople(final String[] ntids, final int callbackIndex) {
    Session.getInstance().getEventBus().addObserver(GotBulkEntityResponseEvent.class,
            new Observer<GotBulkEntityResponseEvent>() {
                public void update(final GotBulkEntityResponseEvent arg1) {
                    List<String> ntidList = Arrays.asList(ntids);
                    JsArray<JavaScriptObject> personJSONArray = (JsArray<JavaScriptObject>) JavaScriptObject
                            .createArray();
                    int count = 0;

                    if (ntidList.size() == arg1.getResponse().size()) {
                        boolean notCorrectResponse = false;
                        for (Serializable person : arg1.getResponse()) {
                            PersonModelView personMV = (PersonModelView) person;
                            if (ntidList.contains(personMV.getAccountId())) {
                                AvatarUrlGenerator urlGen = new AvatarUrlGenerator(EntityType.PERSON);
                                String imageUrl = urlGen.getSmallAvatarUrl(personMV.getAvatarId());

                                JsArrayString personJSON = (JsArrayString) JavaScriptObject.createObject();
                                personJSON.set(0, personMV.getAccountId());
                                personJSON.set(1, personMV.getDisplayName());
                                personJSON.set(2, imageUrl);

                                personJSONArray.set(count, personJSON);
                                count++;
                            } else {
                                notCorrectResponse = true;
                                break;
                            }
                        }
                        if (!notCorrectResponse) {
                            callGotBulkPeopleCallback(personJSONArray, callbackIndex);
                        }
                    }
                }
            });

    ArrayList<StreamEntityDTO> entities = new ArrayList<StreamEntityDTO>();

    for (int i = 0; i < ntids.length; i++) {
        StreamEntityDTO dto = new StreamEntityDTO();
        dto.setUniqueIdentifier(ntids[i]);
        dto.setType(EntityType.PERSON);
        entities.add(dto);
    }

    if (ntids.length == 0) {
        JsArray<JavaScriptObject> personJSONArray = (JsArray<JavaScriptObject>) JavaScriptObject.createArray();
        callGotBulkPeopleCallback(personJSONArray, callbackIndex);
    } else {
        BulkEntityModel.getInstance().fetch(entities, false);
    }
}

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/>/*ww w .  j  a v  a2  s  . c  o  m*/
 *
 * @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.ol3cesium.client.olx.MapOptions.java

License:Apache License

/**
 * Renderer. By default, Canvas, DOM and WebGL renderers are tested for 
 * support in that order, and the first supported used. 
 * Specify a ol.RendererType here to use a specific renderer. 
 * Note that at present only the Canvas renderer supports vector data.
 * @param renderer //from w ww.  ja  va  2 s  .c  om
 */
public final void setRenderer(List<RendererType> renderer) {
    JsArrayString jsArrayString = JavaScriptObject.createArray().cast();
    for (int i = 0; i < renderer.size(); i++) {
        RendererType rendererType = renderer.get(i);
        jsArrayString.set(i, rendererType.toString());
    }
    setRenderer(jsArrayString);
}

From source file:org.openremote.app.client.interop.chartjs.ChartUtil.java

License:Open Source License

static public JavaScriptObject convertLabels(NumberDatapoint[] numberDatapoints) {
    JsArrayString array = (JsArrayString) JsArrayString.createArray();
    for (int i = 0; i < numberDatapoints.length; i++) {
        NumberDatapoint numberDatapoint = numberDatapoints[i];
        array.set(i, numberDatapoint.getLabel());
    }/*  w w w. j av  a2  s  .c  o  m*/
    return array;
}

From source file:org.openremote.manager.client.interop.chartjs.ChartUtil.java

License:Open Source License

static public JsArrayString convertLabels(NumberDatapoint[] numberDatapoints) {
    JsArrayString array = (JsArrayString) JsArrayString.createArray();
    for (int i = 0; i < numberDatapoints.length; i++) {
        NumberDatapoint numberDatapoint = numberDatapoints[i];
        array.set(i, numberDatapoint.getLabel());
    }/*  w w w  .java2  s . c o m*/
    return array;
}

From source file:org.rstudio.studio.client.workbench.ui.PaneConfig.java

License:Open Source License

public static void replaceObsoleteTabs(JsArrayString tabs) {
    for (int idx = 0; idx < tabs.length(); idx++) {
        if (indexOfReplacedTab(tabs.get(idx)) >= 0) {
            tabs.set(idx, getReplacementTabs()[idx]);
        }//from www . j  a v  a 2  s.  c  o m
    }
}