Пример #1
0
  @Override
  public void setInSlot(Object slot, PresenterWidget<?> content) {
    super.setInSlot(slot, content);

    // TODO: Consider switching this to an event bus based mechanism where the
    // child presenter fires an event when it is revealed and the parent highlights the tab.

    // If we're setting a presenter attached to an actual slot, then highlight the tab
    if (slot == tabContentSlot) {
      try {
        Presenter<?, ?> presenter = (Presenter<?, ?>) content;
        TabContentProxy<?> proxy = (TabContentProxy<?>) presenter.getProxy();
        getView().setActiveTab(proxy.getTab());
      } catch (Exception e) {
        // We can't cast, no worry, we just won't highlight a tab
      }
    }
  }
Пример #2
0
 /**
  * Adds a new tab to this presenter. This is meant to be called by a {@link TabContentProxy} in
  * response to a {@link RequestTabsEvent}.
  *
  * @param tabProxy The {@link TabContentProxy} containing information on the tab to add.
  * @return The newly added {@link Tab}.
  */
 public Tab addTab(final TabContentProxy<?> tabProxy) {
   return getView().addTab(tabProxy.getTabData(), tabProxy.getTargetHistoryToken());
 }