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:org.gwtbootstrap3.extras.fullcalendar.client.ui.MonthNames.java

License:Apache License

/**
 * To pass in localized names directly/* w  w  w . j av  a 2 s .  c o m*/
 *
 * @param longNames
 * @param shortNames
 */
public void localize(final String[] longNames, final String[] shortNames) {
    assert longNames != null && longNames.length == 12;
    assert shortNames != null && shortNames.length == 12;
    final JsArrayString longOnes = (JsArrayString) JsArrayString.createArray();
    for (final String name : longNames) {
        longOnes.push(name);
    }

    final JsArrayString shortOnes = (JsArrayString) JsArrayString.createArray();
    for (final String name : shortNames) {
        shortOnes.push(name);
    }
    localize(longOnes, shortOnes);
}

From source file:org.gwtbootstrap3.extras.select.client.ui.MultipleSelect.java

License:Apache License

@Override
protected void setSelectedValue(List<String> value) {
    if (isAttached()) {
        final JsArrayString arr = JavaScriptObject.createArray().cast();
        for (final String val : value) {
            arr.push(val);
        }/*from   ww  w. jav a  2 s. c o  m*/
        setValue(getElement(), arr);
    } else {
        for (Entry<OptionElement, Option> entry : itemMap.entrySet()) {
            Option opt = entry.getValue();
            boolean selected = value.contains(opt.getValue());
            opt.setSelected(selected);
        }
    }
}

From source file:org.gwtbootstrap3.extras.slider.client.ui.base.SliderBase.java

License:Apache License

private void updateSliderForStringArray(SliderOption option, List<String> value) {
    JsArrayString array = JavaScriptObject.createArray().cast();
    for (String val : value) {
        array.push(val);
    }// w w  w .  j av  a 2  s .  c  o m
    if (isAttached()) {
        setAttribute(getElement(), option.getName(), array);
        refresh();
    } else {
        String arrayStr = JsonUtils.stringify(array);
        attributeMixin.setAttribute(option.getDataAttribute(), arrayStr);
    }
}

From source file:org.gwtbootstrap3.extras.summernote.client.ui.base.SummernoteOptions.java

License:Apache License

/**
 * Creates a new toolbar group.//w ww.jav  a  2 s.  c  o  m
 *
 * @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);
}

From source file:org.gwtnode.modules.aws.core.Request.java

License:Apache License

@GwtNodeFunction
public final void emitEvents(List<String> eventNames, Response response,
        JavaScriptFunctionWrapper doneCallback) {
    JsArrayString jsEventNames = JavaScriptObject.createArray().cast();
    if (eventNames != null)
        for (String eventName : eventNames)
            jsEventNames.push(eventName);
    emitEvents(jsEventNames, response, doneCallback.getNativeFunction());
}

From source file:org.jahia.ajax.gwt.client.widget.contentengine.CustomEditEngineTabItem.java

License:Open Source License

@Override
public void init(NodeHolder engine, final AsyncTabItem tab, String language) {
    if (!inited || languageChanged != null) {
        Element element = null;//from   w  w  w.j a  v  a  2s  .  c  o  m

        JsArrayString types = JsArrayString.createArray().cast();
        for (GWTJahiaNodeType type : engine.getNodeTypes()) {
            types.push(type.getName());
        }

        if (languageChanged == null) {
            languageChanged = JahiaGWTParameters.getLanguage();
        }
        String methodName = inited ? onLanguageChangeMethodName : onInitMethodName;

        JavaScriptObject param = null;

        if (engine.isExistingNode() && !engine.isMultipleSelection()) {
            param = convertExistingNode(engine.getNode(), engine.getProperties(), types, language);
        } else if (!engine.isExistingNode() && engine instanceof CreateContentEngine) {
            param = convertNewNode(((CreateContentEngine) engine).getParentPath(), engine.getNodeName(), types,
                    language);
        }

        element = doCall(methodName, param).cast();

        if (element != null) {
            while (tab.getElement().getChildCount() > 0) {
                tab.getElement().removeChild(tab.getElement().getChild(0));
            }
            tab.getElement().appendChild(element);
        }
        inited = true;
        languageChanged = null;
    }

}

From source file:org.jahia.ajax.gwt.client.widget.contentengine.CustomEditEngineTabItem.java

License:Open Source License

public static Object getProperty(Map<String, GWTJahiaNodeProperty> properties, String name) {
    if (properties.containsKey(name)) {
        GWTJahiaNodeProperty property = properties.get(name);
        if (property.isMultiple()) {
            JsArrayString array = JsArrayString.createArray().cast();
            for (GWTJahiaNodePropertyValue value : property.getValues()) {
                array.push(value.getString());
            }/*from  ww w  .  java2s . c  o  m*/
            return array;
        } else {
            return property.getValues().get(0).getString();
        }
    }
    return null;
}

From source file:org.nightcode.gwt.selectio.client.jso.SelectionJso.java

License:Apache License

@Override
public final void setSearchQueries(List<String> searchQueries) {
    JsArrayString array = (JsArrayString) JsArrayString.createArray();
    for (int i = searchQueries.size() - 1; i >= 0; i--) {
        array.push(searchQueries.get(i));
    }/* www.  ja v  a2 s. co m*/
    setQueries(array);
}

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

License:EUPL

/**
 * Set the CSS file(s) to be used to apply style to editor contents.
 * @param contentCss//ww  w.  j  a  v a 2 s. co m
 * @return
 */
public CKEditorConfig setContentCss(List<String> contentCss) {
    this.contentCss = contentCss;
    final JsArrayString jsStrings = (JsArrayString) JsArrayString.createArray();
    for (final String s : contentCss) {
        jsStrings.push(s);
    }
    setNativeContentCss(jsStrings);
    return this;
}

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

License:EUPL

/**
 * Handle <code>VisualStructureModificationEvent</code> GWT event
 * @param editor/* ww w. j a v a  2s  .  c o  m*/
 */
private void handleDrafting(final JavaScriptObject editor) {
    clientFactory.getEventBus().addHandler(VisualStructureModificationEvent.TYPE,
            new VisualStructureModificationEventHandler() {
                @Override
                public void onEvent(VisualStructureModificationEvent event) {
                    //change the text editor
                    final JsArrayString jsKeys = (JsArrayString) JsArrayString.createArray();
                    final JsArrayString jsValues = (JsArrayString) JsArrayString.createArray();
                    for (final Map.Entry<String, String> entry : event.getAttributes().entrySet()) {
                        jsKeys.push(entry.getKey());
                        jsValues.push(entry.getValue());
                    }

                    modify(CKEditorVisualStructureModificationPlugin.this, editor, jsKeys, jsValues);
                }
            });
}