Hi again, I've done some tests and it seems promising. The problem I have is that the get method sometimes returns primitive types (integers) rather than numbers, an old Java problem... I bet others have run into this problem
On Jun 5, 11:18 am, ziglionz <zigli...@gmail.com> wrote: > Hi, > > thanks for your ideas. Definitely wrapping would be needed. > A tough problem wih databinding is the lack of reflection in order to > generate getters and setters. That currently wouldn't work with > overlay types. > But I've had a simple idea: we could have a generic get(property) and > set(property) on the overlay type, therefore removing the need for > reflection. What do you reckon? > > public class NativeMibObject extends JavaScriptObject > { > public NativeMibObject(){} > > // JSNI methods > public final native Object getProperty( String prop ) /*-{ > return > this[prop]; }-*/; > > public final native void setProperty( String prop, Object val > ) /*- > { this[prop] = val; }-*/; > } > > On May 22, 9:39 am, Sumit Chandel <sumitchan...@google.com> wrote: > > > Hi ziglionz, > > > The ability to cast an overlay type to an interface like Binding would > > require the interface itself to also be an overlay type (via the > > JavaScriptObject.cast() method call). Since the interface itself isn't an > > overlay type, and a custom overlay type can't implement it because it does > > indeed require an implementation for methods declared in the interface, > > perhaps you should consider the approach below. > > > You can define a wrapping class over the overlay type that can implement the > > Binding interface. The delegation to the overlay type does incur some > > indirection in code, but in the compiled result, there shouldn't be any > > overhead to pay since the compiler will inline the calls. > > > Hope that helps, > > -Sumit Chandel > > > On Mon, May 18, 2009 at 6:33 PM, ziglionz <zigli...@gmail.com> wrote: > > > > Hi, > > > > I've been looking for a databinding framework for GWT and the two most > > > active ones appear to be the Gwittir and the UFacekit projects. > > > > My question is: can they work at all with overlay types? > > > > I suspect no, due to the limitations of JavaScriptObject > > >http://code.google.com/p/google-web-toolkit/wiki/OverlayTypes > > > > One of those limitations is: "overlay types cannot implement > > > interfaces that define methods". > > > That prevent overlay types from implementing the Bindable interface, > > > that is required for Gwittir. > > > > But one can always add methods to an overlay type without explicitely > > > implementing an interface. > > > I wonder if the compiler would allow us to circumvent the above > > > limitation by forcing a casting of an overlay type to (Binding)... --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to Google-Web-Toolkit@googlegroups.com To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/Google-Web-Toolkit?hl=en -~----------~----~----~----~------~----~------~--~---