Java Code Examples for com.google.gwt.core.client.JsArrayString#push()

The following examples show how to use com.google.gwt.core.client.JsArrayString#push() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
@Override
protected void setSelectedValue(List<String> value) {
    if (isAttached()) {
        final JsArrayString arr = JavaScriptObject.createArray().cast();
        for (final String val : value) {
            arr.push(val);
        }
        setValue(getElement(), arr);
    } else {
        for (Entry<OptionElement, Option> entry : itemMap.entrySet()) {
            Option opt = entry.getValue();
            boolean selected = value.contains(opt.getValue());
            opt.setSelected(selected);
        }
    }
}
 
Example 2
public static JsArrayString getExtensionsToLoad() {
  JsArrayString result = JsArrayString.createArray().cast();
  if (INSTANCE != null) {
    for (String s : INSTANCE.extensions) {
      result.push(s);
    }
  }
  return result;
}
 
Example 3
protected JsArrayString extractOptions(ToolbarButton[] options) {
    JsArrayString jsOptions = JsArrayString.createArray().cast();
    for (ToolbarButton option : options) {
        jsOptions.push(option.getId());
    }
    return jsOptions;
}
 
Example 4
public static String join(final String delimiter, final String... text) {
  final JsArrayString jsa = JavaScriptObject.createArray().cast();

  for (int i = 0; i < text.length; i++) {
    jsa.push(text[i]);
  }

  return jsa.join(delimiter);
}
 
Example 5
Source Project: lumongo   File: JSHelper.java    License: Apache License 2.0 5 votes vote down vote up
public static JsArrayString toJsArray(Iterable<String> values) {
	JsArrayString array = JsArrayString.createArray().cast();
	for (String value : values) {
		array.push(value);
	}
	return array;
}
 
Example 6
public void testRootJsArrayString() {
    JsArrayString array = JavaScriptObject.createArray().cast();
    array.push( "Hello" );
    array.push( "World" );
    array.push( "!" );

    String json = JsArrayStringMapper.INSTANCE.write( array );
    assertEquals( "[\"Hello\",\"World\",\"!\"]", json );

    array = JsArrayStringMapper.INSTANCE.read( json );
    assertEquals( 3, array.length() );
    assertEquals( "Hello", array.get( 0 ) );
    assertEquals( "World", array.get( 1 ) );
    assertEquals( "!", array.get( 2 ) );
}
 
Example 7
Source Project: gwtbootstrap3-extras   File: SliderBase.java    License: Apache License 2.0 5 votes vote down vote up
private void updateSliderForStringArray(SliderOption option, List<String> value) {
    JsArrayString array = JavaScriptObject.createArray().cast();
    for (String val : value) {
        array.push(val);
    }
    if (isAttached()) {
        setAttribute(getElement(), option.getName(), array);
        refresh();
    } else {
        String arrayStr = JsonUtils.stringify(array);
        attributeMixin.setAttribute(option.getDataAttribute(), arrayStr);
    }
}
 
Example 8
/**
 * Set customized font names.
 *
 * @param fontNames customized font names
 * @see SummernoteFontName
 */
public void setFontNames(final SummernoteFontName... fontNames) {
    JsArrayString array = JavaScriptObject.createArray().cast();
    for (SummernoteFontName fontName : fontNames) {
        array.push(fontName.getName());
    }
    options.setFontNames(array);
}
 
Example 9
/**
 * Creates a new toolbar group.
 *
 * @param name
 * @param buttons
 * @return
 */
static final JsArrayMixed newToolbarGroup(String name, ToolbarButton... buttons) {
    JsArrayString arr = JavaScriptObject.createArray().cast();
    for (ToolbarButton button : buttons) {
        arr.push(button.getId());
    }
    return getToolbarGroup(name, arr);
}
 
Example 10
Source Project: dashbuilder   File: AreaChartData.java    License: Apache License 2.0 4 votes vote down vote up
public final void setLabels(String[] labels){
	JsArrayString array = JsArrayString.createArray().cast();
	for(String str : labels)
		array.push(str);
	setLabels(array);
}
 
Example 11
Source Project: swellrt   File: SListProxyHandler.java    License: Apache License 2.0 3 votes vote down vote up
@SuppressWarnings("rawtypes")
public Object ownKeys(SList target) throws SException {

  JsArrayString keys = JavaScriptObject.createArray().<JsArrayString>cast();

  for (int i = 0; i < target.size(); i++)
    keys.push(""+i);

  keys.push("length");

  return keys;
}
 
Example 12
/**
 * Set a list for Web fonts to be ignored. <br>
 * <br>
 * Summernote tests font in fontNames before adding them to drop-down.
 * This is problem while using Web fonts. It’s not easy picking up
 * nice time to check availabilities of Web fonts.
 *
 * @param fontNames
 */
public void setFontNamesIgnoreCheck(final SummernoteFontName... fontNames) {
    JsArrayString array = JavaScriptObject.createArray().cast();
    for (SummernoteFontName fontName : fontNames) {
        array.push(fontName.getName());
    }
    options.setFontNamesIgnoreCheck(array);
}