throws IOException {
Measure width = tabGroup.getCurrentWidth();
Measure headerHeight = getResourceManager().getThemeMeasure(facesContext, tabGroup, "headerHeight");
Measure toolBarWidth = getResourceManager().getThemeMeasure(facesContext, tabGroup, "toolBarWidth");
Style header = new Style();
header.setPosition(Position.RELATIVE);
header.setWidth(width.subtractNotNegative(toolBarWidth));
header.setHeight(headerHeight);
writer.startElement(HtmlElements.DIV, tabGroup);
writer.writeClassAttribute(Classes.create(tabGroup, "header"));
writer.writeStyleAttribute(header);
writer.startElement(HtmlElements.DIV, tabGroup);
writer.writeClassAttribute(Classes.create(tabGroup, "headerInner"));
int index = 0;
for (UIComponent child : tabGroup.getChildren()) {
if (child instanceof UITab) {
UITab tab = (UITab) child;
if (tab.isRendered()) {
LabelWithAccessKey label = new LabelWithAccessKey(tab);
if (activeIndex == index) {
ComponentUtils.addCurrentMarkup(tab, Markup.SELECTED);
}
FacesMessage.Severity maxSeverity = ComponentUtils.getMaximumSeverityOfChildrenMessages(facesContext, tab);
if (maxSeverity != null) {
ComponentUtils.addCurrentMarkup(tab, ComponentUtils.markupOfSeverity(maxSeverity));
}
writer.startElement(HtmlElements.DIV, tab);
writer.writeClassAttribute(Classes.create(tab));
writer.writeAttribute(HtmlAttributes.TABGROUPINDEX, index);
String title = HtmlRendererUtils.getTitleFromTipAndMessages(facesContext, tab);
if (title != null) {
writer.writeAttribute(HtmlAttributes.TITLE, title, true);
}
writer.startElement(HtmlElements.A, tab);
if (!tab.isDisabled()) {
writer.writeAttribute(HtmlAttributes.HREF, "#", false);
}
final String tabId = tab.getClientId(facesContext);
writer.writeIdAttribute(tabId);
if (label.getAccessKey() != null) {
writer.writeAttribute(HtmlAttributes.ACCESSKEY, Character.toString(label.getAccessKey()), false);
}
if (label.getText() != null) {
HtmlRendererUtils.writeLabelWithAccessKey(writer, label);
} else {
writer.writeText(Integer.toString(index + 1));
}
writer.endElement(HtmlElements.A);
if (label.getAccessKey() != null) {
if (LOG.isWarnEnabled()
&& !AccessKeyMap.addAccessKey(facesContext, label.getAccessKey())) {
LOG.warn("duplicated accessKey : " + label.getAccessKey());
}
HtmlRendererUtils.addClickAcceleratorKey(facesContext, tabId, label.getAccessKey());
}
writer.endElement(HtmlElements.DIV);
}
}
index++;
}
writer.endElement(HtmlElements.DIV);
Style body = new Style();
body.setWidth(width);
body.setHeight(tabGroup.getCurrentHeight().subtract(headerHeight));
writer.endElement(HtmlElements.DIV);
if (tabGroup.isShowNavigationBar()) {
UIToolBar toolBar = createToolBar(facesContext, tabGroup);
renderToolBar(facesContext, writer, tabGroup, toolBar);
}