Пример #1
0
 private int indexOf(TabBar bar, TabBar.Tab tab) {
   if (bar != null) {
     for (int i = 0; i < bar.getTabCount(); i++) {
       if (bar.getTab(i).equals(tab)) {
         return i;
       }
     }
   }
   return -1;
 }
Пример #2
0
 public void onBeforeSelection(BeforeSelectionEvent<Integer> bse) {
   buttonClicked = true;
   TabBar tb = (TabBar) bse.getSource();
   cSelIdx = tb.getSelectedTab();
   int selIdx = bse.getItem();
   TabHolder th = findTab(selIdx, tb);
   if (!th.button.isUseDropdown()) {
     th.button.activate();
     bse.cancel();
   } else {
     dropdown.clearHeaderBar();
   }
 }
Пример #3
0
 private TabHolder findTab(int idx, TabBar tb) {
   TabBar.Tab tab = tb.getTab(idx);
   if (tab != null) {
     for (TabHolder th : tabs.values()) {
       if (th.tab.equals(tab)) {
         return th;
       }
     }
   }
   return null;
 }
Пример #4
0
    public void onSelection(SelectionEvent<Integer> ise) {
      TabBar tb = (TabBar) ise.getSource();
      int idx = tb.getSelectedTab();
      if (idx == cSelIdx) {
        tb.selectTab(-1, false);
        dropdown.close();
      } else {
        if (!tb.equals(leftToolbar)) {
          leftToolbar.selectTab(-1, false);
        }
        if (!tb.equals(centerToolbar)) {
          centerToolbar.selectTab(-1, false);
        }
        if (!tb.equals(rightToolbar)) {
          rightToolbar.selectTab(-1, false);
        }

        TabHolder th = findTab(idx, tb);
        if (th != null) {
          th.button.activate();
        }
      }
      buttonClicked = false;
    }