Hi
I want to build a view in GWT but it is one of a few different types of
views. So I was thinking, I could
have them all share something common via inheritance, so that I could inject
any kind of view I'd like into my module...
I'm having trouble binding one of those things together. Any help would be
welcome...
Here's the idea:
The new abstract presenter that things will be based upon:
public abstract class StepModulePresenter<T extends
StepModulePresenter.Display> extends WidgetPresenter<T> {
public interface Display extends WidgetDisplay {
}
@Inject
public StepModulePresenter(T display, EventBus eventBus) {
super(display, eventBus);
}
}
It defines an interface that inherits the WidgetDisplay. Then for example, a
particular type of StepModulePresenter would be:
public class HistoryModulePresenter extends
StepModulePresenter<HistoryModulePresenter.Display> {
@Inject
public HistoryModulePresenter(Display display, EventBus eventBus) {
super(display, eventBus);
bind();
}
...
}
So my view can be defined as:
public class HistoryModuleView extends Composite implements
HistoryModulePresenter.Display {
HistoryModuleView() { ... }
}
So far so good. Now I'd like to use my HistoryModuleView but passed in as a
StepModule in my Main app view:
public class MainView extends Composite implements MainPresenter.Display {
@Inject
public MainView(P1 p1, P2 p2, P3 p3,
StepModulePresenter<StepModulePresenter.Display> module) { ... }
}
What I don't get is how to bind the HistoryModule as the thing that gets
passed in here... And then later on, how I make it one of many things that
can be passed in:
So I've tried the following:
bind(HistoryModulePresenter.class);
bind(HistoryModulePresenter.Display.class).to(HistoryModuleView.class);
bind(StepModulePresenter.class).to(HistoryModulePresenter.class);
bind(StepModulePresenter.Display.class).to(HistoryModuleView.class);
But then I get a compile error saying:
1) No implementation for
com.tyndalehouse.step.web.client.presenter.StepModulePresenter<com.tyndalehouse.step.web.client.presenter.StepModulePresenter$Display>
was bound.
while locating
com.tyndalehouse.step.web.client.presenter.StepModulePresenter<com.tyndalehouse.step.web.client.presenter.StepModulePresenter$Display>
for parameter 4 at
com.tyndalehouse.step.web.client.view.StepView.<init>(StepView.java:25)
at
net.customware.gwt.presenter.client.gin.AbstractPresenterModule.bindDisplay(AbstractPresenterModule.java:42)
Any ideas anyone? Sorry it's a lot of code...
Or am I barking down the wrong track all together? I'm still rather new to
this dependency injection thing, although the more i learn about it, the
more I'm liking it!
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---