Re: [gwt-contrib] Jsni on String methods in GWT 2.7
Getting offtopic, but there is absolutely no requirement that JSO methods are public. See dom.client.Element for several examples of private methods. On Mon, Mar 30, 2015 at 10:27 PM James Nelson ja...@wetheinter.net wrote: Ok, great. Thanks for the heads up. I was pretty sure that Strings had become native first-class objects. Since JSOs will all have public methods, I will be safe with the same fix for String (not using JSNI if not necessary). Given that java arrays only have one field, and that field does not work in JVM reflection, nor do any of the Object methods, I'll leave them alone (that's what java.lang.reflect.Array is for)... Added issue https://code.google.com/p/google-web-toolkit/issues/detail?id=9166 to track this. For posterity and search indexing, if anyone tries to use hashCode, equals or compareTo on String or Array in JSNI and are getting undefined reference errors, use a static method instead. -- You received this message because you are subscribed to the Google Groups GWT Contributors group. To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit-contributors+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit-contributors/9bbd9127-65c9-4fa1-9743-a94fcd4f3bf4%40googlegroups.com https://groups.google.com/d/msgid/google-web-toolkit-contributors/9bbd9127-65c9-4fa1-9743-a94fcd4f3bf4%40googlegroups.com?utm_medium=emailutm_source=footer . For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups GWT Contributors group. To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit-contributors+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit-contributors/CADcXZMyfTkw5Kfm0DXeMLH8%3DXBwFzb1W3qO1xKmGQ%3DjT-w-YGg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
Re: [gwt-contrib] JsInterop Questions
On Tue, Mar 31, 2015 at 2:30 PM, Julien Dramaix julien.dram...@gmail.com wrote: Dear GWT lovers, I've finally started to play with JsInterop in GWT 2.7 and mainly I'm trying to use JsInterop in order to write polymer components. So far, I have two questions: 1. I'm using super dev mode and so I'm obliged to use the CrossSiteIframeLinker. As the javascript code generated by GWT is loaded in an iframe, the exported types are not accessible from the main window (only from the iframe). The workaround I found to expose java type from the main window is to prefix my namespace by *$wnd* @JsNamespace($wnd.jdramaix) public class AgeSliderImpl Isn't it a better way to do that ? Yes, in 2.7 you need to use $wnd to expose your code to main window. In GWT 2.8 snapshot, this is the default behavior, you don't need $wnd. 2. I want to expose some java field of my class to javascript field. I'm trying to use @JsProperty for this purpose but it seems not to work: @JsNamespace($wnd.jdramaix) public class AgeSliderImpl implements AgeSlider { public int age; @Override public int getAge() { return age; }} @JsType public interface AgeSlider { @JsProperty int getAge(); } If I try to access the field in the javascript console,it is undefined: var slider = new jdramaix.AgeSliderImpl() slider.age undefined But the method getAge exists: slider.getAge function getAge_0_g$(){ return this.age_3_g$; } Same problem if I rename the method to age(). slider.age is defined by point to a function. Does @JsProperty work (at least when we export Java to Javascript) in GWT 2.7. ? If so how to use it ? @JsProperty methods defined in @JsType that is implemented by concrete classes does not work with GWT 2.7 (basically the scenario in your code snippet), it doesn't generate the code with a javascript property setter/getters. In GWT 2.8 snapshot, javascript property setter/getter are still not implemented (yet) but instead you can use @JsType with concrete class and a public field, and you can skip the JsType interface completely. i.e. @JsType public class AgeSlider { public int age;} if you want to export the constructor, don't forget to add @JsExport as well. Thanks Julien -- You received this message because you are subscribed to the Google Groups GWT Contributors group. To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit-contributors+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit-contributors/CABb_3%3D6WZanScYy1ZqHBR23yssh9uvDLWe%3DquGaiixcpOusBog%40mail.gmail.com https://groups.google.com/d/msgid/google-web-toolkit-contributors/CABb_3%3D6WZanScYy1ZqHBR23yssh9uvDLWe%3DquGaiixcpOusBog%40mail.gmail.com?utm_medium=emailutm_source=footer . For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups GWT Contributors group. To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit-contributors+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit-contributors/CAN%3DyUA2CSorYH4oHFzGsVrRD1cfnDM1n_jEOJ4upOYyeukm4eQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
[gwt-contrib] JsInterop Questions
Dear GWT lovers, I've finally started to play with JsInterop in GWT 2.7 and mainly I'm trying to use JsInterop in order to write polymer components. So far, I have two questions: 1. I'm using super dev mode and so I'm obliged to use the CrossSiteIframeLinker. As the javascript code generated by GWT is loaded in an iframe, the exported types are not accessible from the main window (only from the iframe). The workaround I found to expose java type from the main window is to prefix my namespace by *$wnd* @JsNamespace($wnd.jdramaix) public class AgeSliderImpl Isn't it a better way to do that ? 2. I want to expose some java field of my class to javascript field. I'm trying to use @JsProperty for this purpose but it seems not to work: @JsNamespace($wnd.jdramaix) public class AgeSliderImpl implements AgeSlider { public int age; @Override public int getAge() { return age; }} @JsType public interface AgeSlider { @JsProperty int getAge(); } If I try to access the field in the javascript console,it is undefined: var slider = new jdramaix.AgeSliderImpl() slider.age undefined But the method getAge exists: slider.getAge function getAge_0_g$(){ return this.age_3_g$; } Same problem if I rename the method to age(). slider.age is defined by point to a function. Does @JsProperty work (at least when we export Java to Javascript) in GWT 2.7. ? If so how to use it ? Thanks Julien -- You received this message because you are subscribed to the Google Groups GWT Contributors group. To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit-contributors+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit-contributors/CABb_3%3D6WZanScYy1ZqHBR23yssh9uvDLWe%3DquGaiixcpOusBog%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.