blob: a8049347b68fe933c42c13ec962214384a3efb27 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
package gwtquery.client;
import com.google.gwt.core.client.JavaScriptObject;
import com.google.gwt.dom.client.Element;
import com.google.gwt.dom.client.Node;
import com.google.gwt.dom.client.NodeList;
/**
*/
public class JSArray extends NodeList<Element> {
public static JSArray create() {
return (JSArray) JavaScriptObject.createArray();
}
public static native JSArray create(Node node) /*-{
return [node];
}-*/;
public static native JSArray create(NodeList nl) /*-{
var r = [], len=nl.length;
for(var i=0; i<len; i++) {
r.push(nl[i]);
}
return r;
}-*/;
protected JSArray() {
}
public final native void addInt(int i) /*-{
this[this.length]=i;
}-*/;
public final native void addNode(Node n) /*-{
this[this.length]=n;
}-*/;
public final native void addNode(Node ci, int i) /*-{
this[i]=ci;
}-*/;
public final native void concat(JSArray ary) /*-{
this.concat(ary);
}-*/;
public final native Element getElement(int i) /*-{
return this[i];
}-*/;
public final native int getInt(int i) /*-{
return this[i] || 0;
}-*/;
public final native Node getNode(int i) /*-{
return this[i];
}-*/;
public final native String getStr(int i) /*-{
return this[i] || null;
}-*/;
public final void pushAll(JSArray prevElem) {
for (int i = 0, ilen = prevElem.size(); i < ilen; i++) {
addNode(prevElem.getNode(i));
}
}
public final native int size() /*-{
return this.length;
}-*/;
}
|