protected void encodeContents(FacesContext context, TabView tabView) throws IOException { ResponseWriter writer = context.getResponseWriter(); String var = tabView.getVar(); int activeIndex = tabView.getActiveIndex(); boolean dynamic = tabView.isDynamic(); writer.startElement("div", null); writer.writeAttribute("class", TabView.PANELS_CLASS, null); if (var == null) { int j = 0; for (int i = 0; i < tabView.getChildCount(); i++) { UIComponent child = tabView.getChildren().get(i); if (child.isRendered() && child instanceof Tab) { encodeTabContent(context, (Tab) child, j, (j == activeIndex), dynamic); j++; } } } else { int dataCount = tabView.getRowCount(); //boundary check activeIndex = activeIndex >= dataCount ? 0 : activeIndex; Tab tab = (Tab) tabView.getChildren().get(0); for (int i = 0; i < dataCount; i++) { tabView.setIndex(i); encodeTabContent(context, tab, i, (i == activeIndex), dynamic); } tabView.setIndex(-1); } writer.endElement("div"); }
protected void encodeContents(FacesContext context, TabView tabView) throws IOException { ResponseWriter writer = context.getResponseWriter(); String var = tabView.getVar(); int activeIndex = tabView.getActiveIndex(); boolean dynamic = tabView.isDynamic(); writer.startElement("div", null); writer.writeAttribute("class", TabView.PANELS_CLASS, null); if (var == null) { int i = 0; for (UIComponent kid : tabView.getChildren()) { if (kid.isRendered() && kid instanceof Tab) { encodeTabContent(context, (Tab) kid, i, (i == activeIndex), dynamic); i++; } } } else { int dataCount = tabView.getRowCount(); //boundary check activeIndex = activeIndex >= dataCount ? 0 : activeIndex; Tab tab = (Tab) tabView.getChildren().get(0); for (int i = 0; i < dataCount; i++) { tabView.setIndex(i); encodeTabContent(context, tab, i, (i == activeIndex), dynamic); } tabView.setIndex(-1); } writer.endElement("div"); }