我正在开发一个使用 GWTP 的项目,我想知道是否可以将视图的对象注入另一个视图。就像是:
public class BarView extends ViewWithUiHandlers<BarUiHandlers> implements BarPresenter.BarView {
public interface Binder extends UiBinder<HTMLPanel, BarView> {
}
@UiField SomeWidget someWidget;
@Inject
public PlayerView(Binder binder) {
initWidget(binder.createAndBindUi(this));
}
}
public class FooView extends ViewWithUiHandlers<FooUiHandlers> implements FooPresenter.FooView {
public interface Binder extends UiBinder<HTMLPanel, FooView> {
}
SomeWidget someWidget;
@Inject
public PlayerView(Binder binder, SomeWidget someWidget) {
initWidget(binder.createAndBindUi(this));
this.someWidget = someWidget;
}
}
这行得通吗?有人知道如何做到这一点吗?