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:com.ait.toolkit.xdm.client.XdmSocket.java

License:Open Source License

/**
 * Use this to only allow specific domains to consume this provider. The
 * patterns can contain the wildcards ? and * as in the examples
 * 'http://example.com', '.foo.com' and 'dom?.com', or they can be regular
 * expressions starting with ^ and ending with $. If none of the patterns
 * match an Error will be thrown./*from   w w w.  j  a  va2 s  .  c o m*/
 */
public XdmSocket setAcl(String... acls) {
    JsArrayString values = JsArrayString.createArray().cast();
    for (String s : acls) {
        values.push(s);
    }
    return setAcl(values);

}

From source file:com.arcbees.chosen.client.gwt.ChosenListBox.java

License:Apache License

/**
 * Return the values of all selected options in an array.
 * Usefull to know which options are selected in case of multiple ChosenListBox
 *
 * @return the values of all selected options in an array
 *///from   www . j a  va 2s  .c  o  m
public String[] getValues() {
    ChosenImpl impl = getChosenImpl();

    if (impl != null) {
        List<String> selectedValues = impl.getSelectedValues();
        return selectedValues.toArray(new String[selectedValues.size()]);
    } else {
        JsArrayString values = JsArrayString.createArray().cast();
        NodeList<OptionElement> options = SelectElement.as(getElement()).getOptions();
        for (int i = 0; i < options.getLength(); i++) {
            OptionElement option = options.getItem(i);
            if (option.isSelected()) {
                values.push(option.getValue());
            }
        }

        String[] result = new String[values.length()];
        for (int i = 0; i < values.length(); i++) {
            result[i] = values.get(i);
        }

        return result;
    }
}

From source file:com.badlogic.gdx.backends.gwt.GwtMusic.java

License:Apache License

public GwtMusic(FileHandle file) {
    String url;//from w w  w.  j a  va2  s. c o  m
    if (file.type() == Files.FileType.Internal && !(file instanceof AsyncFileHandle)) {
        url = ((GwtApplication) Gdx.app).getBaseUrl() + file.path();
    } else {
        byte[] data = file.readBytes();
        char[] encodedChars = Base64Coder.encode(data);

        //WTF, GWT?
        JsArrayString parts = (JsArrayString) JsArrayString.createArray();
        parts.push("data:audio/wav;base64,");
        for (int i = 0; i < encodedChars.length; i += 1024) {
            String part = new String(encodedChars, i, Math.min(1024, encodedChars.length - i));
            parts.push(part);
        }
        url = parts.join("");
    }
    sound = SoundManager.createSound(url);
    soundOptions = new SMSoundOptions();
    soundOptions.callback = this;
}

From source file:com.bedatadriven.rebar.sql.client.bulk.PreparedStatementBatch.java

License:Apache License

public void addExecution(Object... parameters) {
    JsArrayString array = JsArray.createArray().cast();
    for (int i = 0; i != parameters.length; ++i) {
        Object param = parameters[i];
        if (param instanceof Date)
            array.push(Long.toString(((Date) param).getTime()));
        else//  w  ww  . j  a v a 2 s.c  o  m
            array.push(param.toString());
    }
    getExecutions().push(array);
}

From source file:com.brazoft.foundation.gwt.client.util.MessageFormat.java

License:Apache License

public static <T> String format(final String pattern, final T... args) {
    if (null == args || 0 == args.length)
        return pattern;

    JsArrayString array = JavaScriptObject.createArray().cast();
    for (Object arg : args) {
        array.push(String.valueOf(arg));
    }/* w  w w.  j a  v a 2  s . c  o m*/

    return nativeFormat(pattern, array);
}

From source file:com.codenvy.ide.ext.web.css.editor.CssPartialParser.java

License:Open Source License

private JsArrayString getValuesAndSpecialValues(JsArrayString existingValues) {
    JsArrayString valuesAndSpecialValuesAfter = JavaScriptObject.createArray().cast();
    for (int i = 0; i < existingValues.length(); i++) {
        String value = existingValues.get(i);
        JsArrayString specialValues = getSpecialValues(value);
        if (specialValues.length() == 0) {
            valuesAndSpecialValuesAfter.push(value);
        }/*w ww  . j a v  a  2s.c  o  m*/
        for (int j = 0; j < specialValues.length(); j++) {
            valuesAndSpecialValuesAfter.push(specialValues.get(j));
        }
    }
    return valuesAndSpecialValuesAfter;
}

From source file:com.codenvy.ide.ext.web.css.editor.CssPartialParser.java

License:Open Source License

private JsArrayString getSpecialValues(String value) {
    JsArrayString specialValues = JavaScriptObject.createArray().cast();
    if (value.isEmpty()) {
        return specialValues;
    }/*w  ww .  ja v a  2  s.co  m*/
    if (checkIfAngle(value)) {
        specialValues.push(ANGLE);
    }
    if (checkIfInteger(value)) {
        specialValues.push(INTEGER);
    }
    if (checkIfNumber(value)) {
        specialValues.push(NUMBER);
    }
    if (checkIfUri(value)) {
        specialValues.push(URI);
    }
    if (checkIfPercentage(value)) {
        specialValues.push(PERCENTAGE);
    }
    if (checkIfString(value)) {
        specialValues.push(STRING);
    }
    if (checkIfCounter(value)) {
        specialValues.push(COUNTER);
    }
    if (checkIfIdentifier(value)) {
        specialValues.push(IDENTIFIER);
    }
    if (checkIfFrequency(value)) {
        specialValues.push(FREQUENCY);
    }
    if (checkIfColor(value)) {
        specialValues.push(COLOR);
    }
    if (checkIfLength(value)) {
        specialValues.push(LENGTH);
    }
    if (checkIfShape(value)) {
        specialValues.push(SHAPE);
    }
    return specialValues;
}

From source file:com.emitrom.ti4j.mobile.client.android.Android.java

License:Apache License

/**
 * Registers broadcast receiver for the given actions
 *//*from ww  w. j  a v  a2s.  co  m*/
public void registerBroadcastReceiver(BroadcastReceiver broadcastReceiver, String... actions) {
    JsArrayString values = JsArray.createArray().cast();
    for (String action : actions) {
        values.push(action);
        registerBroadcastReceiver(broadcastReceiver, values);
    }
}

From source file:com.emitrom.ti4j.mobile.client.cloud.chats.ChatMessage.java

License:Apache License

/**
 * Comma separated user id(s) of the recipient(s). The current user id and
 * to_ids together determine which chat group a message belongs to.
 * <p>// w ww  .j a  v a 2s  . co  m
 * Alternatively, you can use chat_group_id to identify a chat group
 * instead.
 * 
 * @param ids
 */
public void setToIds(String... ids) {
    JsArrayString toIds = JsArrayString.createArray().cast();
    for (String s : ids) {
        toIds.push(s);
    }
    setToIds(toIds.join(","));
}

From source file:com.emitrom.ti4j.mobile.client.cloud.core.Query.java

License:Apache License

/**
 * Comma separated user id(s) of the recipient(s). The current user id and
 * to_ids together determine which chat group a message belongs to.
 * <p>/*from  w  w w. ja  v a  2  s  .c o m*/
 * Alternatively, you can use chat_group_id to identify a chat group
 * instead.
 * 
 * @param ids
 */
public void setParticipateIds(String... ids) {
    JsArrayString toIds = JsArrayString.createArray().cast();
    for (String s : ids) {
        toIds.push(s);
    }
    setParticipateIds(toIds.join(","));
}