private void autoSizeTabs() { int count = getItemCount(); if (count == 0) return; int aw = bar.getClientWidth(); int each = (int) Math.max(Math.min(Math.floor((aw - 4) / count) - getTabMargin(), tabWidth), getMinTabWidth()); for (int i = 0; i < count; i++) { El el = getItem(i).header.el(); Element inner = el.childNode(1).firstChild().firstChild().dom; int tw = el.getWidth(); int iw = fly(inner).getWidth(); fly(inner).setWidth(each - (tw - iw)); } }
/** * Scrolls to a particular tab if tab scrolling is enabled. * * @param item the item to scroll to * @param animate true to animate the scroll */ public void scrollToTab(TabItem item, boolean animate) { if (item == null) return; int pos = getScollPos(); int area = getScrollArea(); El itemEl = item.header.el(); int left = itemEl.getOffsetsTo(stripWrap.dom).x + pos; int right = left + itemEl.getWidth(); if (left < pos) { scrollTo(left, animate); } else if (right > (pos + area)) { scrollTo(right - area, animate); } }
/** * Sets the item's icon. * * @param icon the icon */ public void setIcon(AbstractImagePrototype icon) { this.icon = icon; if (rendered) { El node = el().selectNode(".x-tab-image"); if (node != null) { node.remove(); } if (icon != null) { Element e = icon.createElement().cast(); e.setClassName("x-tab-image"); el().appendChild(e); } el().setStyleName("x-tab-with-icon", icon != null); } }
private void renderItem(TabItem item, int index) { if (item.header.isRendered()) { strip.insertChild(item.header.getElement(), index); } else { item.header.render(strip.dom, index); } if (!GXT.isFocusManagerEnabled()) { item.header.el().setElementAttribute("hideFocus", "true"); item.header.el().setStyleAttribute("-moz-outline", "none"); } else { Accessibility.setState(item.header.getElement(), "aria-controls", item.getId()); item.getAriaSupport().setLabelledBy(item.header.getId()); } }
void onItemOver(TabItem item, boolean over) { item.header.el().setStyleName("x-tab-strip-over", over); }
/** * Sets the header's HTML content. * * @param html the html to set */ public void setHtml(String html) { this.html = html; if (rendered) { el().child(".x-tab-strip-text").dom.setInnerHTML(Util.isEmptyString(html) ? " " : html); tabPanel.onItemTextChange(TabItem.this, this.html, html); } }
private void focusTab(TabItem item, boolean setFocus) { if (setFocus && !GXT.isIE7) { item.getHeader().el().focus(); } if (GXT.isFocusManagerEnabled()) { FocusFrame.get().frame(this); } }