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

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

Introduction

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

Prototype

public final native int get(int index) ;

Source Link

Document

Gets the value at a given index.

Usage

From source file:nz.co.doltech.gwtjui.interactions.client.ui.Sortable.java

License:Apache License

public JsPoint getGrid() {
    JsArrayInteger array = getOption("grid");
    return new JsPoint(array.get(0), array.get(1));
}

From source file:org.cruxframework.crux.core.client.encoder.MD5.java

License:Apache License

/**
 * Calculate the HMAC-MD5, of a key and some data (raw strings)
 */// ww w .j  a va 2s. c o  m
public static String rawHmacMD5(String key, String data) {
    JsArrayInteger bkey = rstr2binl(key);
    if (bkey.length() > 16)
        bkey = binl2md5(bkey, key.length() * 8);

    JsArrayInteger ipad = JsArrayInteger.createArray().cast();
    JsArrayInteger opad = JsArrayInteger.createArray().cast();
    ipad.setLength(16);
    opad.setLength(16);
    for (int i = 0; i < 16; i++) {
        ipad.set(i, bkey.get(i) ^ 0x36363636);
        opad.set(i, bkey.get(i) ^ 0x5C5C5C5C);
    }

    JsArrayInteger hash = binl2md5(concat(ipad, rstr2binl(data)), 512 + data.length() * 8);
    return binl2rstr(binl2md5(concat(opad, hash), 512 + 128));
}

From source file:org.daxplore.presenter.client.json.shared.JsonTools.java

License:Open Source License

/**
 * Convert a {@link JsArrayInteger} to an int array.
 * //from  w  w w.  j a v  a 2s  .co  m
 * @param jsArray
 *            the js array
 * @return the int[]
 */
public static int[] jsArrayAsArray(JsArrayInteger jsArray) {
    int[] javaArray = new int[jsArray.length()];
    for (int i = 0; i < jsArray.length(); i++) {
        javaArray[i] = jsArray.get(i);
    }
    return javaArray;
}

From source file:org.daxplore.presenter.client.json.shared.JsonTools.java

License:Open Source License

/**
 * Convert a {@link JsArrayInteger} to a List<Integer>.
 * /*from w  ww. ja  v  a 2  s.  c  o m*/
 * @param jsArray
 *            the js array
 * @return the list
 */
public static List<Integer> jsArrayAsList(JsArrayInteger jsArray) {
    List<Integer> list = new LinkedList<Integer>();
    for (int i = 0; i < jsArray.length(); i++) {
        list.add(jsArray.get(i));
    }
    return list;
}

From source file:org.geowe.client.local.model.vector.format.GeoJSONCSS.java

License:Open Source License

public VectorFeatureStyleDef getStyleDef(JSObject styleObject) {
    VectorFeatureStyleDef def = new VectorFeatureStyleDef();

    if (styleObject.hasProperty(LeafletStyle.FILL_COLOR_NAME)) {
        String fillColor = styleObject.getPropertyAsString(LeafletStyle.FILL_COLOR_NAME);
        def.getFill().setNormalColor(fillColor);
    }//from   w ww .  j  a v a  2  s .  co m

    if (styleObject.hasProperty(LeafletStyle.FILL_OPACITY_NAME)) {
        Double fillOpacity = styleObject.getPropertyAsDouble(LeafletStyle.FILL_OPACITY_NAME);
        def.getFill().setOpacity(fillOpacity);
    }

    if (styleObject.hasProperty(LeafletStyle.STROKE_COLOR_NAME)) {
        String strokeColor = styleObject.getPropertyAsString(LeafletStyle.STROKE_COLOR_NAME);
        def.getLine().setNormalColor(strokeColor);
    }

    if (styleObject.hasProperty(LeafletStyle.STROKE_WIDTH_NAME)) {
        Double strokeWidth = styleObject.getPropertyAsDouble(LeafletStyle.STROKE_WIDTH_NAME);
        def.getLine().setThickness(strokeWidth.intValue());
    }

    JSObject iconObject = styleObject.getProperty(LeafletStyle.ICON_NAME);
    if (iconObject != null) {

        if (iconObject.hasProperty(LeafletStyle.ICON_URL_NAME)) {
            String iconUrl = iconObject.getPropertyAsString(LeafletStyle.ICON_URL_NAME);
            def.getPoint().setExternalGraphic(iconUrl);
        }

        if (iconObject.hasProperty(LeafletStyle.ICON_SIZE_NAME)) {
            JsArrayInteger iconSize = iconObject.getProperty(LeafletStyle.ICON_SIZE_NAME).cast();

            int iconWidth = iconSize.get(0);
            int iconHeight = iconSize.get(1);

            def.getPoint().setGraphicWidth(iconWidth);
            def.getPoint().setGraphicHeight(iconHeight);
        }
    }

    return def;
}

From source file:org.jboss.demos.server.dmr.DataOutput.java

License:Open Source License

public void writeFloat(float v) throws IOException {
    growToFit(4);/*from   ww  w .j  av  a  2s.  c  om*/
    JsArrayInteger bytes = IEEE754.fromFloat(v);
    for (int i = 0; i < 4; i++) {
        this.bytes[pos++] = (byte) bytes.get(i);
    }
}

From source file:org.jboss.demos.server.dmr.DataOutput.java

License:Open Source License

public void writeDouble(double v) throws IOException {
    growToFit(8);//from w  ww. ja  v a2 s .  co m
    JsArrayInteger bytes = IEEE754.fromDouble(v);
    for (int i = 0; i < 8; i++) {
        this.bytes[pos++] = (byte) bytes.get(i);
    }
}

From source file:org.jboss.dmr.client.DataOutput.java

License:Open Source License

public void writeDouble(double v) throws IOException {
    growToFit(8);// w w  w  . ja  v a2 s . c o m
    JsArrayInteger bytes = IEEE754.fromDoubleClosure(v);
    for (int i = 0; i < 8; i++) {
        this.bytes[pos++] = (byte) bytes.get(i);
    }
}

From source file:org.opennms.features.topology.app.internal.gwt.client.handler.DragObject.java

License:Open Source License

public DragObject(TopologyView<TopologyViewRenderer> svgTopologyMap, Element draggableElement,
        Element containerElement, D3 selection) {

    m_svgTopologyMap = svgTopologyMap;/*from w ww  .  j  ava2 s .c  o m*/
    m_draggableElement = draggableElement;
    m_containerElement = containerElement;
    m_selection = selection;

    m_selection.each(new Handler<GWTVertex>() {

        @Override
        public void call(GWTVertex vertex, int index) {
            Point p = new Point(vertex.getX(), vertex.getY());
            m_startPosition.put(vertex.getId(), p);
        }
    });

    //User m_vertexgroup because this is what we scale instead of every vertex element
    m_transform = D3.getTransform(D3.d3().select(getTopologyView().getVertexGroup()).attr("transform"));

    JsArrayInteger position = D3.getMouse(containerElement);
    m_startX = (int) (position.get(0) / m_transform.getScale().get(0));
    m_startY = (int) (position.get(1) / m_transform.getScale().get(1));
}

From source file:org.opennms.features.topology.app.internal.gwt.client.handler.DragObject.java

License:Open Source License

public int getCurrentX() {
    JsArrayInteger position = D3.getMouse(m_containerElement);
    return (int) (position.get(0) / m_transform.getScale().get(0));
}