1.1 --- a/javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/Element.java Tue Dec 04 09:16:53 2012 +0100
1.2 +++ b/javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/Element.java Sat Jan 12 10:44:37 2013 +0100
1.3 @@ -37,18 +37,14 @@
1.4 body="var e = window.document.getElementById(el.fld_id);\n"
1.5 + "e[property] = value;\n"
1.6 )
1.7 - static void setAttribute(Element el, String property, Object value) {
1.8 - throw new UnsupportedOperationException("Needs JavaScript!");
1.9 - }
1.10 + static native void setAttribute(Element el, String property, Object value);
1.11
1.12 @JavaScriptBody(
1.13 args={"el", "property"},
1.14 body="var e = window.document.getElementById(el.fld_id);\n"
1.15 + "return e[property];\n"
1.16 )
1.17 - static Object getAttribute(Element el, String property) {
1.18 - throw new UnsupportedOperationException("Needs JavaScript!");
1.19 - }
1.20 + static native Object getAttribute(Element el, String property);
1.21
1.22 /** Executes given runnable when user performs a "click" on the given
1.23 * element.
1.24 @@ -59,7 +55,12 @@
1.25 body="var e = window.document.getElementById(el.fld_id);\n"
1.26 + "e.onclick = function() { r.run__V(); };\n"
1.27 )
1.28 - public final void addOnClick(Runnable r) {
1.29 - throw new UnsupportedOperationException("Needs JavaScript!");
1.30 - }
1.31 + public final native void addOnClick(Runnable r);
1.32 +
1.33 + /** Shows alert message dialog in a browser.
1.34 + * @param msg the message to show
1.35 + */
1.36 + @JavaScriptBody(args = "msg", body = "alert(msg);")
1.37 + public static native void alert(String msg);
1.38 +
1.39 }