Beispiel #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;
 }
Beispiel #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();
   }
 }
Beispiel #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;
 }
Beispiel #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;
    }