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