/** * Removes all mappings from this map. */ public void clear() { ScriptHelper.evalNoResult("this.obj.clear()", null); }
public HashMap() { ScriptHelper.evalNoResult("this.obj = new Hashtable(_ed.hashCodeFunction, _ed.equalsFunction)", null); }
public JSObject() { ScriptHelper.evalNoResult("this.obj = new Object()", null); }
public void remove(String key) { ScriptHelper.put("key", key, null); ScriptHelper.evalNoResult("delete this.obj[key]", null); }
public String[] keys() { ScriptHelper.evalNoResult("var keys = new Array(); for (var e in this.obj) keys.push(e)", null); return (String[]) ScriptHelper.eval("keys", null); } }
public void setFragment(String fragment) { ScriptHelper.put("fragment", fragment, this); ScriptHelper.evalNoResult("window.location.hash = fragment", this); } }
public JSObject(Object obj) { ScriptHelper.put("obj", obj, null); ScriptHelper.evalNoResult("this.obj = obj", null); }
public JSObject(String javascriptRef) { ScriptHelper.put("javascriptRef", javascriptRef, null); ScriptHelper.evalNoResult("this.obj = eval(javascriptRef)", null); }
public void cancelAnimationFrame(long requestID) { ScriptHelper.put("requestID", requestID, this); ScriptHelper.evalNoResult("cancelAnimationFrame(requestID)", this); }
public void set(Object obj, Object value) throws IllegalAccessException, IllegalArgumentException { tmpArray[0]= value; Method.boxArguments(new Class<?>[] { fieldType }, tmpArray); // #FIXME passing the value will cause a bug. the value wont be updated because 2nd compiler changed its var name. Static also dont change. ScriptHelper.put("obj", obj, this); ScriptHelper.put("sig", this.signature, this); ScriptHelper.put("value", tmpArray[0], this); if ((getModifiers() & Modifier.STATIC) != 0) ScriptHelper.evalNoResult("obj.constructor[sig]= value", this); else ScriptHelper.evalNoResult("obj[sig]= value", this); }
public void put(String key, T value) { ScriptHelper.put("key", key, null); ScriptHelper.put("value", value, null); ScriptHelper.evalNoResult("this.obj[key] = value", null); }
public void onHashChange(Runnable aRunnable) { Runnable runnableForDebugging= wrapRunnableForDebugging(aRunnable); ScriptHelper.put("ra", runnableForDebugging, this); ScriptHelper.evalNoResult("window.onhashchange= function() {ra.$run$void();}", this); }
public void onResize(Runnable aRunnable) { Runnable runnableForDebugging= wrapRunnableForDebugging(aRunnable); ScriptHelper.put("ra", runnableForDebugging, this); ScriptHelper.evalNoResult("window.addEventListener('resize', function() {ra.$run$void();})", this); }
public static void setElementInnerHTML(Element label1, String aText) { ScriptHelper.put("element", label1, null); ScriptHelper.put("value", aText, null); ScriptHelper.evalNoResult("element.node.innerHTML= value", null); }
/** * Returns the index within this string of the first occurrence of the specified substring, starting at the specified index. */ public int indexOf(int strr, int position) { //FIXME dragome is making char as a int when using charAt( ) so this method is needed or it will give error by saying method dont exist. ScriptHelper.put("strr", strr, this); ScriptHelper.evalNoResult("var str = String.fromCharCode(strr)", this); ScriptHelper.put("position", position, this); return ScriptHelper.evalInt("this.indexOf(str, position)", this); }
/** * Compares this string to the specified object. */ public boolean equals(Object obj) { if (this == obj) return true; if (obj instanceof String) { ScriptHelper.put("obj", obj, this); ScriptHelper.evalNoResult("var string1 = String(this)", this); ScriptHelper.evalNoResult("var string2 = String(obj)", this); int n1 = ScriptHelper.evalInt("string1.length", this); int n2 = ScriptHelper.evalInt("string2.length", this); if (n1 == n2) { int i = 0; while (n1-- != 0) { ScriptHelper.put("i", i, this); boolean flag = ScriptHelper.evalBoolean("string1.charAt(i) == string2.charAt(i)", this); if (!flag) return false; i++; } return true; } } return false; }
private void updateChecked(final VisualCheckbox checkbox, Element button1) { boolean checked= checkbox.getValue() != null && checkbox.getValue(); String isChecked= checked ? "true" : "false"; ScriptHelper.put("checked", isChecked, this); ScriptHelper.put("button1", button1, this); ScriptHelper.evalNoResult("button1.node.checked= (checked == 'true')", this); // // if (checked) // button1.setAttribute("checked", "checked"); // else // button1.removeAttribute("checked"); } });
trail= trail.substring(getMatchIndex(matchObj) + getMatchLength(matchObj, 0), trail.length()); ScriptHelper.evalNoResult("compiled.lastIndex = 0", this); ScriptHelper.evalNoResult("out.length = lastNonEmpty", this);
ScriptHelper.evalNoResult("textFieldElement.node.value=value", this);