writer.writeStyleAttribute(headerStyle);
writer.startElement(HtmlConstants.TR, null);
writer.writeAttribute(HtmlAttributes.VALIGN, "bottom", false);
UITab activeTab = null;
int index = 0;
for (UIComponent child: (List<UIComponent>) component.getChildren()) {
if (child instanceof UITab) {
UITab tab = (UITab) child;
if (tab.isRendered()) {
String onclick;
if (TobagoConfig.getInstance(facesContext).isAjaxEnabled()
&& SWITCH_TYPE_RELOAD_TAB.equals(switchType)) {
onclick = null;
} else if (SWITCH_TYPE_RELOAD_PAGE.equals(switchType)
|| SWITCH_TYPE_RELOAD_TAB.equals(switchType)) {
onclick = "tobago_requestTab('"
+ clientId + "'," + index + ",'"
+ ComponentUtil.findPage(facesContext, component).getFormId(facesContext) + "')";
} else { // SWITCH_TYPE_CLIENT
onclick = "tobago_selectTab('"
+ clientId + "'," + index + ','
+ component.getChildCount() + ')';
}
LabelWithAccessKey label = new LabelWithAccessKey(tab);
StyleClasses outerClass = new StyleClasses();
StyleClasses innerClass = new StyleClasses();
if (virtualTab == index) {
outerClass.addClass("tab", "selected-outer");
innerClass.addClass("tab", "selected-inner");
activeTab = (UITab) tab;
} else {
outerClass.addClass("tab", "unselected-outer");
innerClass.addClass("tab", "unselected-inner");
}
outerClass.addMarkupClass(tab, "tab", "outer");
innerClass.addMarkupClass(tab, "tab", "outer");
writer.startElement(HtmlConstants.TD, tab);
writer.writeIdAttribute(tab.getClientId(facesContext));
writer.writeAttributeFromComponent(HtmlAttributes.TITLE, ATTR_TIP);
writer.startElement(HtmlConstants.DIV, null);
writer.writeClassAttribute(outerClass);
writer.startElement(HtmlConstants.DIV, null);
writer.writeClassAttribute(innerClass);
writer.startElement(HtmlConstants.SPAN, null);
String tabId = clientId + "." + virtualTab + SUBCOMPONENT_SEP + index;
writer.writeIdAttribute(tabId);
if (tab.isDisabled()) {
writer.writeClassAttribute("tobago-tab-disabled");
} else {
writer.writeClassAttribute("tobago-tab-link");
if (onclick != null) {
writer.writeAttribute(HtmlAttributes.ONCLICK, onclick, true);