int spacerMinWidth = spacerCell.getOffsetWidth() - div.getOffsetWidth();
int tabsWidth = tb.getOffsetWidth() - spacerWidth + spacerMinWidth;
// Find content width
Style style = tp.getElement().getStyle();
String overflow = style.getProperty("overflow");
style.setProperty("overflow", "hidden");
style.setPropertyPx("width", tabsWidth);
Style wrapperstyle = tp.getWidget(tp.getVisibleWidget()).getElement()
.getParentElement().getStyle();
wrapperstyle.setPropertyPx("width", tabsWidth);
// Get content width from actual widget
int contentWidth = 0;
if (tp.getWidgetCount() > 0) {
contentWidth = tp.getWidget(tp.getVisibleWidget()).getOffsetWidth();
}
style.setProperty("overflow", overflow);
// Set widths to max(tabs,content)
if (tabsWidth < contentWidth) {
tabsWidth = contentWidth;
}
int outerWidth = tabsWidth + getContentAreaBorderWidth();
tabs.getStyle().setPropertyPx("width", outerWidth);
style.setPropertyPx("width", tabsWidth);
wrapperstyle.setPropertyPx("width", tabsWidth);
contentNode.getStyle().setPropertyPx("width", tabsWidth);
super.setWidth(outerWidth + "px");
updateOpenTabSize();
}