나는 이것을 알아 냈다고 생각합니다. TabLayoutPanel와 발표자에
(의이 MainPresenter를 부르 자) :
@ContentSlot public static final Type<RevealContentHandler<?>> SLOT_first = new Type<RevealContentHandler<?>>();
@ContentSlot public static final Type<RevealContentHandler<?>> SLOT_second = new Type<RevealContentHandler<?>>();
public interface MyView extends View {
public void setMainPresenter(MainPresenter presenter);
public TabLayoutPanel getTeamsPanel();
}
@Inject PlaceManager placeMananger;
@Inject FirstPresenter firstPresenter;
@Inject SecondPresenter secondPresenter;
@ProxyCodeSplit
public interface MyProxy extends Proxy<MainPresenter> {
}
@Inject
public MainPresenter(final EventBus eventBus, final MyView view,
final MyProxy proxy) {
super(eventBus, view, proxy);
view.setMainPresenter(this);
}
@Override
protected void revealInParent() {
RevealRootContentEvent.fire(this, this);
}
public void setTabContents(Integer tab) {
if (tab == 0) {
placeMananger.revealPlace(new PlaceRequest("first"));
} else if (tab == 1) {
placeMananger.revealPlace(new PlaceRequest("second"));
}
이 그런 다음 MAINVIEW에 로컬 참조를 저장하는 방법 setMainPresenter()를 구현합니다. 보통 setInSlot()를 구현 한 후이 탭 처리기를 추가 :
@UiHandler("mainTabs")
void onMainTabsBeforeSelection(BeforeSelectionEvent<Integer> event) {
mainPresenter.setTabContents(event.getItem());
}
핸들러는 사용자가 탭을 변경 MainPresenter 때마다 호출합니다. setTabContents()는 적절한 "tab"Presenter에 대해 revealInParent()를 호출합니다.