I tried to extend TextItem and overwrite its setValue method to call via JSNI a Java method.
It succeeded with a static method but failed with a instance method.
Running this code in Hosted Mode throws an exception:
Uncaught JavaScript exception [Das Objekt unterstützt diese Eigenschaft oder Methode nicht.]
Could anyone help me?
It succeeded with a static method but failed with a instance method.
Running this code in Hosted Mode throws an exception:
Uncaught JavaScript exception [Das Objekt unterstützt diese Eigenschaft oder Methode nicht.]
Could anyone help me?
Code:
package de.auco.smartgwt.test.client; import com.smartgwt.client.util.SC; import com.smartgwt.client.widgets.form.fields.TextItem; public class CustomTextItem extends TextItem { static { defineClass(); } private final static native void defineClass()/*-{ $wnd.isc.defineClass("CustomTextItem", $wnd.isc.TextItem); $wnd.isc.CustomTextItem.addProperties({ setValue: function(value) { @de.auco.smartgwt.test.client.CustomTextItem::staticDoSomething(Ljava/lang/String;)(value); this.@de.auco.smartgwt.test.client.CustomTextItem::instanceDoSomething(Ljava/lang/String;)(value); this.Super("setValue", arguments); } }); }-*/; public static void staticDoSomething(String value){ SC.say("static method called"); } public void instanceDoSomething(String value){ SC.say("instance method called"); } protected CustomTextItem(String name) { super(name); setType("CustomText"); } }
Comment