类com.google.gwt.core.client.JsArrayInteger源码实例Demo

下面列出了怎么用com.google.gwt.core.client.JsArrayInteger的API类实例代码及写法,或者点击链接到github查看源代码。

private native JsArrayInteger getAbsolutePosition(Element elem) /*-{
    var curr = elem;
    var left = 0;
    var top = 0;

    if ($doc.getElementById) {
        do  {
            left += elem.offsetLeft - elem.scrollLeft;
            top += elem.offsetTop - elem.scrollTop;

            elem = elem.offsetParent;
            curr = curr.parentNode;
            while (curr != elem) {
                left -= curr.scrollLeft;
                top -= curr.scrollTop;

                curr = curr.parentNode;
            }
        } while (elem.offsetParent);
    }

    return [left, top];
}-*/;
 
源代码2 项目: actor-platform   文件: JsMessage.java
@Override
public JsMessage convert(Message value) {
    JsMessenger messenger = JsMessenger.getInstance();

    String rid = value.getRid() + "";
    String sortKey = value.getSortDate() + "";

    JsPeerInfo sender = messenger.buildPeerInfo(Peer.user(value.getSenderId()));
    boolean isOut = value.getSenderId() == messenger.myUid();
    boolean isOnServer = value.isOnServer();
    String date = messenger.getFormatter().formatTime(value.getDate());
    JsDate fullDate = JsDate.create(value.getDate());

    JsContent content = JsContent.createContent(value.getContent(),
            value.getSenderId());

    JsArray<JsReaction> reactions = JsArray.createArray().cast();

    for (Reaction r : value.getReactions()) {
        JsArrayInteger uids = (JsArrayInteger) JsArrayInteger.createArray();
        boolean isOwnSet = false;
        for (Integer i : r.getUids()) {
            uids.push(i);
            if (i == messenger.myUid()) {
                isOwnSet = true;
            }
        }
        reactions.push(JsReaction.create(r.getCode(), uids, isOwnSet));
    }
    double sortDate = value.getDate() / 1000.0;
    return create(rid, sortKey, sender, isOut, date, fullDate, Enums.convert(value.getMessageState()), isOnServer, content,
            reactions, sortDate);
}
 
源代码3 项目: geowe-core   文件: LeafletStyle.java
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
		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;
	}
 
源代码4 项目: gwt-jackson   文件: FastArrayShort.java
public FastArrayShort() {
	if(GWT.isScript()) {
		stackNative = JsArrayInteger.createArray().cast();
	} else {
		stackJava = new JsList<Short>();
	}
}
 
源代码5 项目: gwt-jackson   文件: FastArrayInteger.java
public FastArrayInteger(){
	if(GWT.isScript()) {
		stackNative = JsArrayInteger.createArray().cast();
	} else {
		stackJava = new JsList<Integer>();
	}
}
 
源代码6 项目: gwtbootstrap3-extras   文件: TagsInputBase.java
/**
 * Array of keycodes which will add a tag when typing in the input.
 * (default: [13, 188], which are ENTER and comma)
 * 
 * @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);
}
 
源代码7 项目: core   文件: DataOutput.java
public void writeFloat(float v) throws IOException {
    growToFit(4);
    JsArrayInteger bytes = IEEE754.fromFloat(v);
    for (int i = 0; i < 4; i++) {
        this.bytes[pos++] = (byte)bytes.get(i);
    }
}
 
源代码8 项目: core   文件: DataOutput.java
public void writeDouble(double v) throws IOException {
    growToFit(8);
    JsArrayInteger bytes = IEEE754.fromDoubleClosure(v);
    for (int i = 0; i < 8; i++) {
        this.bytes[pos++] = (byte)bytes.get(i);
    }
}
 
源代码9 项目: core   文件: IEEE754.java
public static native JsArrayInteger fromDoubleClosure(double a) /*-{
   var f = 11; // ebits
   var c = 52; // fbits
   var b=(1<<f-1)-1,d,e;
   if(isNaN(a))
       e=(1<<b)-1,b=1,d=0;
   else if(Infinity===a||-Infinity===a)
       e=(1<<b)-1,b=0,d=0>a?1:0;
   else if(0===a)
       b=e=0,d=-Infinity===1/a?1:0;
   else if(d=0>a,a=Math.abs(a),a>=Math.pow(2,1-b)){
       var g=Math.min(Math.floor(Math.log(a)/Math.LN2),b);
       e=g+b;
       b=a*Math.pow(2,c-g)-Math.pow(2,c)
   }
   else
       e=0,b=a/Math.pow(2,1-b-c);
   for(a=[];c;c-=1)
       a.push(b%2?1:0),b=Math.floor(b/2);
   for(c=f;c;c-=1)
       a.push(e%2?1:0),e=Math.floor(e/2);
   a.push(d?1:0);
   a.reverse();
   f=a.join("");
   for(d=[];f.length;)
       d.push(parseInt(f.substring(0,8),2)),f=f.substring(8);
   return d;
}-*/;
 
源代码10 项目: cuba   文件: AceEditorWidget.java
public int[] getCursorCoords() {
	JsArrayInteger cc = editor.getCursorCoords();
	return new int[] {cc.get(0), cc.get(1)};
}
 
源代码11 项目: cuba   文件: GwtAceEditor.java
public final native JsArrayInteger getCursorCoords() /*-{
	var p = this.getCursorPositionScreen();
	var c = this.renderer.textToScreenCoordinates(p.row,p.column);
	return [c.pageX,c.pageY];
}-*/;
 
源代码12 项目: cuba   文件: GwtAceEditor.java
public final native JsArrayInteger getCoordsOfRowCol(int row, int column) /*-{
	var p = this.getSession().documentToScreenPosition({row:row, column:column});
	var c = this.renderer.textToScreenCoordinates(p.row, p.column);
	return [c.pageX,c.pageY];
}-*/;
 
源代码13 项目: cuba   文件: GwtAceEditor.java
public final native JsArrayInteger getCoordsOf(GwtAcePosition pos) /*-{
	var p = this.getSession().documentToScreenPosition(pos);
	var c = this.renderer.textToScreenCoordinates(p.row, p.column);
	return [c.pageX,c.pageY];
}-*/;
 
源代码14 项目: actor-platform   文件: JsReaction.java
public static native JsReaction create(String reaction, JsArrayInteger uids, boolean isOwnSet)/*-{
    return {reaction: reaction, uids: uids, isOwnSet: isOwnSet};
}-*/;
 
源代码15 项目: geowe-core   文件: GeoJSONCSS.java
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);
	}

	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;
}
 
源代码16 项目: gwt-jackson   文件: FastArrayShort.java
private static native short[] reinterpretCast( JsArrayInteger value ) /*-{
    return value;
}-*/;
 
源代码17 项目: gwt-jackson   文件: FastArrayInteger.java
private static native int[] reinterpretCast( JsArrayInteger value ) /*-{
    return value;
}-*/;
 
源代码18 项目: gwtbootstrap3-extras   文件: GeneralDisplay.java
public native void setHiddenDays(JsArrayInteger hiddenDays) /*-{
    var theInstance = this;
    [email protected]eralDisplay::general.hiddenDays = hiddenDays;
}-*/;
 
源代码19 项目: gwtbootstrap3-extras   文件: TagsInputOptions.java
public final native void setConfirmKeys(JsArrayInteger keys) /*-{
    this.confirmKeys = keys;
}-*/;
 
源代码20 项目: core   文件: IEEE754.java
public static native JsArrayInteger fromFloat(float v)/*-{
    var ebits = 8;
    var fbits = 23;
    var bias = (1 << (ebits - 1)) - 1;

    // Compute sign, exponent, fraction
    var s, e, f;
    if (isNaN(v)) {
        e = (1 << bias) - 1; f = 1; s = 0;
    }
    else if (v === Infinity || v === -Infinity) {
        e = (1 << bias) - 1; f = 0; s = (v < 0) ? 1 : 0;
    }
    else if (v === 0) {
        e = 0; f = 0; s = (1 / v === -Infinity) ? 1 : 0;
    }
    else {
        s = v < 0;
        v = Math.abs(v);

        if (v >= Math.pow(2, 1 - bias)) {
            var ln = Math.min(Math.floor(Math.log(v) / Math.LN2), bias);
            e = ln + bias;
            f = v * Math.pow(2, fbits - ln) - Math.pow(2, fbits);
        }
        else {
            e = 0;
            f = v / Math.pow(2, 1 - bias - fbits);
        }
    }

    // Pack sign, exponent, fraction
    var i, bits = [];
    for (i = fbits; i; i -= 1) { bits.push(f % 2 ? 1 : 0); f = Math.floor(f / 2); }
    for (i = ebits; i; i -= 1) { bits.push(e % 2 ? 1 : 0); e = Math.floor(e / 2); }
    bits.push(s ? 1 : 0);
    bits.reverse();
    var str = bits.join('');

    // Bits to bytes
    var bytes = [];
    while (str.length) {
        bytes.push(parseInt(str.substring(0, 8), 2));
        str = str.substring(8);
    }
    return bytes;
}-*/;
 
源代码21 项目: core   文件: IEEE754.java
public static native JsArrayInteger fromDouble(double v)/*-{
    var ebits = 11;
    var fbits = 52;
    var bias = (1 << (ebits - 1)) - 1;

    // Compute sign, exponent, fraction
    var s, e, f;
    if (isNaN(v)) {
        e = (1 << bias) - 1; f = 1; s = 0;
    }
    else if (v === Infinity || v === -Infinity) {
        e = (1 << bias) - 1; f = 0; s = (v < 0) ? 1 : 0;
    }
    else if (v === 0) {
        e = 0; f = 0; s = (1 / v === -Infinity) ? 1 : 0;
    }
    else {
        s = v < 0;
        v = Math.abs(v);

        if (v >= Math.pow(2, 1 - bias)) {
            var ln = Math.min(Math.floor(Math.log(v) / Math.LN2), bias);
            e = ln + bias;
            f = v * Math.pow(2, fbits - ln) - Math.pow(2, fbits);
        }
        else {
            e = 0;
            f = v / Math.pow(2, 1 - bias - fbits);
        }
    }

    // Pack sign, exponent, fraction
    var i, bits = [];
    for (i = fbits; i; i -= 1) { bits.push(f % 2 ? 1 : 0); f = Math.floor(f / 2); }
    for (i = ebits; i; i -= 1) { bits.push(e % 2 ? 1 : 0); e = Math.floor(e / 2); }
    bits.push(s ? 1 : 0);
    bits.reverse();
    var str = bits.join('');

    // Bits to bytes
    var bytes = [];
    while (str.length) {
        bytes.push(parseInt(str.substring(0, 8), 2));
        str = str.substring(8);
    }
    return bytes;
}-*/;
 
源代码22 项目: swellrt   文件: JsArraySort.java
/**
 * Sorts a JsArray of integers.
 *
 * @param sortMe Array to be sorted.
 * @param comparator Comparator to be used, per native JS sort() method.
 */
public static native void sort(JsArrayInteger sortMe, JavaScriptObject comparator) /*-{
  sortMe.sort(comparator);
}-*/;
 
源代码23 项目: incubator-retired-wave   文件: JsArraySort.java
/**
 * Sorts a JsArray of integers.
 *
 * @param sortMe Array to be sorted.
 * @param comparator Comparator to be used, per native JS sort() method.
 */
public static native void sort(JsArrayInteger sortMe, JavaScriptObject comparator) /*-{
  sortMe.sort(comparator);
}-*/;