Hi,
I just started experimenting with the new jsinterop and I have one question.@JsType(isNative = true)
public class JQuery {
@JsMethod(namespace = JsPackage.GLOBAL)
public static native JQuerySelection $(String selector);
}
public class JQuery {
@JsMethod(namespace = JsPackage.GLOBAL)
public static native JQuerySelection $(String selector);
}
where JQuerySelection is
@JsType(isNative = true)
public class JQuerySelection {
}
@JsType(isNative = true)
public class JQuerySelection {
}
and it works! Great
Now let's try to bring bootstrap inside. I want to user their modals. The way to get a modal is through jquery. Let's extend the jqueryselection
JsType(isNative = true)
public class BootstrapModal extends JQuerySelection {
public native void modal(String command);
@JsOverlay
public final void show() {
modal("show");
}
@JsOverlay
public final void hide() {
modal("hide");
}
}
//////////////////// java caller ----- It crashes on cast
((BootstrapModal) JQuery.$("#modal_id")).show();
Now when I try this from my java code it crashes (saying that mypackage name (com.mypackage.) is not a property)
What is the way to use jsinterop in order to capture the implicit parent/child relationship between BootstrapModal and JquerySelection?I work around it by adding in BootstrapModal this
@JsMethod(namespace = JsPackage.GLOBAL, name="$")
public static native BootstrapModal getModal(String selector);
public static native BootstrapModal getModal(String selector);
but it doesn't strike me as the correct way to do it.
Any hints?
--
--
Vassilis Virvilis
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment