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:gwt.material.design.addins.client.richeditor.base.ToolBarManager.java

License:Apache License

protected JsArrayString extractOptions(ToolbarButton[] options) {
    JsArrayString jsOptions = JsArrayString.createArray().cast();
    for (ToolbarButton option : options) {
        jsOptions.push(option.getId());
    }//from  w  w w.j  a va2  s  .com
    return jsOptions;
}

From source file:net.codemirror.lib.Extras.java

License:Apache License

public final void setAnnotations(JsArray<BlameInfo> blameInfos) {
    if (blameInfos.length() > 0) {
        setBlameInfo(blameInfos);//  w w w  . ja  v  a  2s .c om
        JsArrayString gutters = ((JsArrayString) JsArrayString.createArray());
        gutters.push(ANNOTATION_GUTTER_ID);
        cm.setOption("gutters", gutters);
        annotated = true;
        DateTimeFormat format = DateTimeFormat.getFormat(DateTimeFormat.PredefinedFormat.DATE_SHORT);
        JsArray<LintLine> annotations = JsArray.createArray().cast();
        for (BlameInfo blameInfo : Natives.asList(blameInfos)) {
            for (RangeInfo range : Natives.asList(blameInfo.ranges())) {
                Date commitTime = new Date(blameInfo.time() * 1000L);
                String shortId = blameInfo.id().substring(0, 8);
                String shortBlame = C.shortBlameMsg(shortId, format.format(commitTime), blameInfo.author());
                String detailedBlame = C.detailedBlameMsg(blameInfo.id(), blameInfo.author(),
                        FormatUtil.mediumFormat(commitTime), blameInfo.commitMsg());

                annotations.push(
                        LintLine.create(shortBlame, detailedBlame, shortId, Pos.create(range.start() - 1)));
            }
        }
        cm.setOption("lint", getAnnotation(annotations));
    }
}

From source file:nz.co.doltech.gwtjui.core.client.js.JsArrayUtil.java

License:Apache License

public static JsArrayString fromStrings(Collection<String> collection) {
    JsArrayString array = JsArrayString.createArray().cast();
    for (String item : collection) {
        array.push(item);
    }//from   www .  j a  v  a  2s.  c  o m
    return array;
}

From source file:open.pandurang.gwt.youtube.test.client.YouTube.java

License:Open Source License

public void onModuleLoad() {
    YouTubePlayer.loadYouTubeIframeApi();
    YouTubePlayer.addApiReadyHandler(new ApiReadyEventHandler() {

        public void onApiReady(ApiReadyEvent event) {
            PlayerConfiguration config = (PlayerConfiguration) PlayerConfiguration.createObject();
            config.setVideoId("M7lc1UVf-VE");
            config.setHeight("562.5");
            config.setWidth("1000");
            final YouTubePlayer player = new YouTubePlayer(config);
            player.addPlayerReadyHandler(new PlayerReadyEventHandler() {

                public void onPlayerReady(PlayerReadyEvent event) {
                    GWT.log("First player is ready.");
                    GWT.log("First player state -> " + player.getPlayer().getPlayerState());
                }//from  w  w  w .  j  a  va2  s  .  co  m
            });
            player.addStateChangedHandler(new StateChangeEventHandler() {

                public void onStateChange(StateChangeEvent event) {
                    GWT.log("First player state changed => " + event.getPlayerEvent().getData());
                }
            });
            RootPanel.get().add(player);
            Button btn = new Button("Stop");
            btn.addClickHandler(new ClickHandler() {

                public void onClick(ClickEvent event) {
                    player.getPlayer().stopVideo();
                    GWT.log("First player state -> " + player.getPlayer().getPlayerState());
                }
            });
            RootPanel.get().add(btn);
            config = (PlayerConfiguration) PlayerConfiguration.createObject();
            config.setVideoId("4biVZcgCn9A");
            PlayerVariables playerVars = (PlayerVariables) PlayerVariables.createObject();

            playerVars.setControls(0);
            playerVars.setRel(0);
            playerVars.setShowInfo(0);
            playerVars.setShowInfo(0);
            config.setPlayerVars(playerVars);
            final YouTubePlayer player1 = new YouTubePlayer(config);
            RootPanel.get().add(player1);

            Button btnCue = new Button("Cue");
            btnCue.addClickHandler(new ClickHandler() {

                public void onClick(ClickEvent event) {
                    JsArrayString list = (JsArrayString) JsArrayString.createArray();
                    list.push("tQIBhsDlTxU");
                    list.push("4jGFreAGRI4");
                    player1.getPlayer().cuePlaylist(list, 0, 0, "highres");
                }
            });
            RootPanel.get().add(btnCue);

        }
    });
}

From source file:org.cruxframework.crux.plugin.gadget.client.features.osapi.albums.GetAlbumsRequestBuilder.java

License:Apache License

/**
 * Sets a list of IDs specifying the {@link Album}s to retrieve.
 *
 * @param ids A list of IDs.//from  ww w  .  java2s  . c om
 */
public final GetAlbumsRequestBuilder setIds(String... ids) {
    JsArrayString array = JavaScriptObject.createArray().cast();
    for (String id : ids) {
        array.push(id);
    }
    return nativeSet("id", array);
}

From source file:org.cruxframework.crux.plugin.gadget.client.features.osapi.mediaitems.GetMediaItemsRequestBuilder.java

License:Apache License

/**
 * Sets a list of MediaItem IDs specifying the MediaItems to retrieve.
 *
 * @param ids IDs specifying the MediaItems to retrieve.
 *//*from   ww  w . j  ava 2s. c  o m*/
public final GetMediaItemsRequestBuilder setIds(String... ids) {
    JsArrayString array = JavaScriptObject.createArray().cast();
    for (String id : ids) {
        array.push(id);
    }
    return nativeSet("id", array);
}

From source file:org.cruxframework.crux.plugin.gadget.client.features.osapi.people.GetPeopleRequestBuilder.java

License:Apache License

/**
 * Defines a set of fields to be requested.
 * //from   w  w w.java 2 s. c  o  m
 * @see PeopleService#setDefaultFields(String...)
 * 
 * @param fields A set of fields to be requested.
 */
public final GetPeopleRequestBuilder setFields(String... fields) {
    JsArrayString array = JavaScriptObject.createArray().cast();
    for (String field : fields) {
        array.push(field);
    }
    return setFields(array);
}

From source file:org.cruxframework.crux.plugin.gadget.client.features.osapi.people.GetPersonRequestBuilder.java

License:Apache License

/**
 * Defines a set of fields to be requested.
 * /*from  w ww  .j  a v  a  2s. c  om*/
 * @see PeopleService#setDefaultFields(String...)
 * 
 * @param fields A set of fields to be requested.
 */
public final GetPersonRequestBuilder setFields(String... fields) {
    JsArrayString array = JavaScriptObject.createArray().cast();
    for (String field : fields) {
        array.push(field);
    }
    return setFields(array);
}

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

License:Apache License

@SuppressWarnings("unchecked")
protected final JsArrayString getRefs(String key) {
    JsArrayString result = (JsArrayString) parseJSON("[]");

    JsArray<JsReference> refs = (JsArray<JsReference>) getArray(key);

    if (key != null) {
        for (int i = 0; i < refs.length(); i++) {
            String ref = refs.get(i).getRef();

            if (!ref.isEmpty()) {
                result.push(ref);
            }//from  ww  w.jav  a  2 s .co m
        }
    }

    return result;
}

From source file:org.eclipse.che.ide.editor.codemirror.client.CodeMirrorDocument.java

License:Open Source License

private void fireTextChangeEvent(final CMBeforeChangeEventOverlay param) {
    final TextPosition from = new TextPosition(param.getFrom().getLine(), param.getFrom().getCharacter());
    final TextPosition to = new TextPosition(param.getTo().getLine(), param.getTo().getCharacter());
    final TextChange change = new TextChange.Builder().from(from).to(to).insert(param.getText().join("\n"))
            .build();/*w w w . jav a  2 s  .  co m*/
    final TextChangeEvent event = new TextChangeEvent(change, new ChangeUpdater() {
        @Override
        public void update(TextChange updatedChange) {
            final CMPositionOverlay from = CMPositionOverlay.create(updatedChange.getFrom().getLine(),
                    updatedChange.getFrom().getCharacter());
            final CMPositionOverlay to = CMPositionOverlay.create(updatedChange.getTo().getLine(),
                    updatedChange.getTo().getCharacter());
            final String newText = updatedChange.getNewText();
            final String[] split = newText.split("\n");
            final JsArrayString text = JavaScriptObject.createArray().cast();
            for (final String s : split) {
                text.push(s);
            }
            param.update(from, to, text);
        }
    });
    getDocEventBus().fireEvent(event);
}