On Thursday, June 7, 2012 4:43:40 PM UTC+2, Shaun Tarves wrote: > > Hi Thomas - > > I went down the road of the PlaceHyperlink [trying to create as extension > of Hyperlink with a method setDestination(Place)]. My intention was that > PlaceHyperlink could be used in UIBinder, and my presenters wouldn't all > need to pass through a PlaceHistoryMapper. > > I have GIN set up, so I'm trying to inject my PlaceHistoryMapper into my > PlaceHyperlink (as a field injection - to avoid the missing no-arg > constructor problem), but no dice. That PHM is always null (although it > works fine in other places when constructor-injected). > > I don't totally understand why this doesn't work. Any thoughts how to > implement a PlaceHyperlink with UIBinder and GIN? >
You can either use a @UiFactory or use @UiField(provided=true) in your views (but that's a lot of boilerplate) or use a static field and requestStaticInjection(PlaceHyperlink.class) in your GinModule. I don't quite like it but it works, and I've been using it for the past year on a few widgets (particularly SuggestBox-like widgets, providing them the RequestFactory). There's an issue on the tracker about making UiBinder more GIN-friendly but that's not an easy patch… -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/6EBTyXa-ek0J. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
