1.) You should use EventBus instead of SimpleEventBus in your
I18NLabel.
2.) Is your MyWidgetGinjector really empty? If so, there should be at
least one method that gets called during app initialization
(onModuleLoad). So for example:
@GinModules(MyWidgetClientModule.class)
public interface MyWidgetGinjector extends Ginjector {
public MyAppMainPanel getApplicationPanel();
}
Also GIN will only inject the EventBus to your I18NLabel if the
I18NLabel itself has been injected into some other class that is
already managed by GIN (for example into MyAppMainPanel). If you do
so, then you may want to add a bind(I18NLabel.class) to your
GinModule. Currently your GinModule does not know I18NLabel and when
you try to inject that label into another class, then GIN will try to
create it with GWT.create(I18NLabel.class). But this will require a no-
arg default constructor in your I18NLabel...I guess thats why you got
the exception.
I hope that helps.
On 1 Nov., 15:31, xworker <[email protected]> wrote:
> Hi all
>
> Trying to inject the eventbus into a component but I'm getting the
> "has no default (zero args) constructor." error. Any clues what I'm
> doing wrong? Very new to GIN, so it might be trivial..
>
> Here is my code:
>
> module:
> public class MyWidgetClientModule extends AbstractGinModule {
> protected void configure() {
>
> bind(EventBus.class).to(SimpleEventBus.class).in(Singleton.class);
>
> }
> }
>
> injector:
> @GinModules(MyWidgetClientModule.class)
> public interface MyWidgetGinjector extends Ginjector {
>
> }
>
> and the component I trying to inject:
> public class I18NLabel extends Label implements
> ChangeLanguageEventHandler{
>
> private final SimpleEventBus eventBus;
> private String key;
>
> @Inject
> public I18NLabel(SimpleEventBus eventBus) {
> this.eventBus = eventBus;
> }
> ...
> ...
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
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.