Example usage for com.google.gwt.core.client JsArrayInteger push

List of usage examples for com.google.gwt.core.client JsArrayInteger push

Introduction

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

Prototype

public final native void push(int value) ;

Source Link

Document

Pushes the given integer onto the end of the array.

Usage

From source file:com.gwtdaily.interapp.eventbus.client.ModuleAEntryPoint.java

License:Apache License

@Override
public void onModuleLoad() {

    if (!InterAppEventBus.isSupported()) {
        Window.alert("Sorry, Custom event in this browser.");
    }/*from w w w . j  ava 2  s  . co m*/

    Button button = new Button();
    button.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            JsArrayInteger data = ((JsArrayInteger) JsArrayInteger.createArray(1));
            data.push(1);
            data.push(2);
            InterAppEventBus.fireEvent("test1", data);
        }
    });

    InterAppEventBus.addListener(new InterAppEventHandler() {

        @Override
        public void onEvent(JavaScriptObject data) {
            Window.alert(getType() + " event captured in parent module and data is " + data.toString());
        }

        @Override
        public String getType() {
            return "test1";
        }
    });

    button.setText("Test");

    RootPanel.get("module_A").add(button);
}

From source file:com.shc.webgl4j.client.WEBGL_draw_buffers.java

License:Open Source License

public static void glDrawBuffersWEBGL(int... buffers) {
    JsArrayInteger array = JsArrayInteger.createArray(buffers.length).cast();

    for (int buffer : buffers)
        array.push(buffer);

    glDrawBuffersWEBGL(array);// www  .  ja  va 2  s  .com
}

From source file:com.shc.webgl4j.client.WEBGL_draw_buffers.java

License:Open Source License

public static void glDrawBuffersWEBGL(Int32Array buffers) {
    JsArrayInteger array = JsArrayInteger.createArray(buffers.length()).cast();

    for (int i = 0; i < buffers.length(); i++)
        array.push(buffers.get(i));

    glDrawBuffersWEBGL(array);//from ww  w .ja  v a  2 s  . c o m
}

From source file:gwt.g3d.client.gl2.array.JsArrayUtils.java

License:Apache License

/**
 * Converts from a Java array to a JavaScript array.
 * /*from  w  w w  .ja va2  s  .co  m*/
 * @param array the Java array to convert from.
 * @return the equivalent JavaScript array.
 */
public static JsArrayInteger toJsArrayInteger(int... array) {
    JsArrayInteger jsArray = JsArrayInteger.createArray().cast();
    for (int v : array) {
        jsArray.push(v);
    }
    return jsArray;
}

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

License:Apache License

public static JsArrayInteger fromIntegers(Collection<Integer> collection) {
    JsArrayInteger array = JsArrayInteger.createArray().cast();
    for (Integer item : collection) {
        array.push(item);
    }/*  w w w  .jav a 2  s.  co  m*/
    return array;
}

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

License:Apache License

public JsPoint(int x, int y) {
    JsArrayInteger jsX = (JsArrayInteger) JsArrayInteger.createArray();
    jsX.push(x);
    array.set(0, jsX);//  w ww  .  ja  v a2  s  .  co m

    JsArrayInteger jsY = (JsArrayInteger) JsArrayInteger.createArray();
    jsY.push(y);
    array.set(1, jsY);
}

From source file:org.geowe.client.local.model.style.LeafletStyle.java

License:Open Source License

public static JSObject getStyle(VectorStyleDef def) {

    String fillColor = def.getFill().getNormalColor();
    Double fillOpacity = def.getFill().getOpacity();
    String strokeColor = def.getLine().getNormalColor();
    Double strokeWidth = new Double(def.getLine().getThickness());

    JSObject styleObject = JSObject.createJSObject();
    styleObject.setProperty(FILL_NAME, true);
    styleObject.setProperty(FILL_COLOR_NAME, fillColor);
    styleObject.setProperty(FILL_OPACITY_NAME, fillOpacity);
    styleObject.setProperty(STROKE_COLOR_NAME, strokeColor);
    styleObject.setProperty(STROKE_WIDTH_NAME, strokeWidth);
    styleObject.setProperty(RADIUS_NAME, RADIUS_VALUE);

    //icon/*from   w  w  w  .java  2  s.co  m*/
    String iconUrl = def.getPoint().getExternalGraphic();
    if (iconUrl != null) {
        JSObject iconObject = JSObject.createJSObject();
        iconObject.setProperty(ICON_URL_NAME, iconUrl);
        JsArrayInteger iconSize = JSObject.createArray().cast();

        iconSize.push(def.getPoint().getGraphicWidth());
        iconSize.push(def.getPoint().getGraphicHeight());

        JSObject iconSizeObject = iconSize.cast();

        iconObject.setProperty(ICON_SIZE_NAME, iconSizeObject);

        styleObject.setProperty(ICON_NAME, iconObject);
    }

    return styleObject;
}

From source file:org.gwtbootstrap3.extras.fullcalendar.client.ui.GeneralDisplay.java

License:Apache License

public void setHiddenDays(final int... days) {
    if (days != null) {
        final JsArrayInteger intArr = (JsArrayInteger) JsArrayInteger.createArray();
        for (final int i : days) {
            assert i >= 0 && i <= 6;
            intArr.push(i);
        }/*ww  w  .  j a  va 2  s.  com*/
        setHiddenDays(intArr);
    }
}

From source file:org.gwtbootstrap3.extras.tagsinput.client.ui.base.TagsInputBase.java

License:Apache License

/**
 * Array of keycodes which will add a tag when typing in the input.
 * (default: [13, 188], which are ENTER and comma)
 * //from   ww w  .  j  a v  a  2s  .  co m
 * @param confirmKeys Array of keycodes
 */
public void setConfirmKeys(final List<Integer> confirmKeys) {
    JsArrayInteger keys = JsArrayInteger.createArray().cast();

    for (int key : confirmKeys) {
        keys.push(key);
    }
    options.setConfirmKeys(keys);
}

From source file:org.gwtnode.modules.cassandra.UUID.java

License:Apache License

/**
 * Factory method that returns a UUID object.
 * /*  w w w  . jav  a 2s  . c  o m*/
 * @param bytes
 *          The 16 bytes of a UUID
 * @return UUID
 */
@GwtNodeFunction
public static final UUID fromBytes(byte[] bytes) {
    JsArrayInteger jsBytes = JavaScriptObject.createArray().cast();
    if (bytes != null)
        for (int b : bytes)
            jsBytes.push(b);
    return fromBytes(jsBytes);
}