Generic methods for querying and changing attributes
authorJaroslav Tulach <jaroslav.tulach@apidesign.org>
Sat, 12 Jan 2013 20:27:52 +0100
changeset 43642f0ad9e4152
parent 435 fb4ed6cc0d4b
child 437 d7ec46950980
Generic methods for querying and changing attributes
javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/Element.java
     1.1 --- a/javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/Element.java	Sat Jan 12 20:24:30 2013 +0100
     1.2 +++ b/javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/Element.java	Sat Jan 12 20:27:52 2013 +0100
     1.3 @@ -62,5 +62,20 @@
     1.4       */
     1.5      @JavaScriptBody(args = "msg", body = "alert(msg);")
     1.6      public static native void alert(String msg);
     1.7 +
     1.8 +    /** Generic way to query any attribute of this element.
     1.9 +     * @param property name of the attribute
    1.10 +     */
    1.11 +    public final Object getAttribute(String property) {
    1.12 +        return getAttribute(this, property);
    1.13 +    }
    1.14      
    1.15 +    /** Generic way to change an attribute of this element.
    1.16 +     * 
    1.17 +     * @param property name of the attribute
    1.18 +     * @param value value to associate with the attribute
    1.19 +     */
    1.20 +    public final void setAttribute(String property, Object value) {
    1.21 +        setAttribute(this, property, value);
    1.22 +    }
    1.23  }