Saturday, July 31, 2010

Re: Can Gin inject eventBus into a widget that's created from uiBinder?

On 31 July, 00:26, David Grant <> wrote:
> Inject your eventBus in to the widget, it will work just fine, then "new"
> your widget or create it by using injection, or whatever.

As mentioned in topic title and in my message, the widget is being
*created by uiBinder*.

> You only need <ui:with> if you need to access some object in the ui.xml file
> that you want to be constructed somewhere else. Typically this is some
> object that get injected in to the ui.xml associated .java class or it is a
> Resources object (typically also injected).
> Example:
> public class MyWidget extends Composite {
>   private static MyWidgetUiBinder uiBinder =
> GWT.create(MyWidgetBinder.class);
>   interface MyWidgetUiBinder extends UiBinder<Widget, MyWidget> {
>   }
>   private final EventBus bus;
>   @UiField
>   private HTMLPanel outerPanel;
>   @Inject
>   public MyWidget(EventBus bus) {
>     this.bus = bus;
>     initWidget(uiBinder.createAndBindUi(this));
>   }
> }

I've now tried incorporating Gin and following your suggestions.
Introducing a no-argument constructor causes my application to fail to

01:00:41.503 [ERROR] [testapp] has
no default (zero args) constructor. To fix this, you can define a
@UiFactory method on the UiBinder's owner, or annotate a constructor
of Mailboxes with @UiConstructor.

Any ideas? Does your response address injecting resources into widgets
created by uiBinder?


You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to
To unsubscribe from this group, send email to
For more options, visit this group at

No comments:

Post a Comment