try {
final DataVisitor visitor = new AbstractTogglePanelItemVisitor(tabPanel, new AbstractTogglePanelItemVisitor.TabVisitorCallback() {
@Override
public DataVisitResult visit(AbstractTogglePanelItemInterface item)
{
AbstractTab tab = (AbstractTab) item;
TabRenderer renderer = (TabRenderer) tab.getRenderer(context);
try {
renderer.writeJavaScript(writer, context, tab);
} catch (IOException e) {
throw new RuntimeException(e);
}
return DataVisitResult.CONTINUE;
}
});
tabPanel.walk(context, visitor, null);
} finally {
tabPanel.setRowKey(context, null);
}
} else {
if (tabPanel.getChildCount() > 0) {
for (UIComponent child : tabPanel.getChildren()) {
if (child instanceof AbstractTab) {
AbstractTab tab = (AbstractTab) child;
TabRenderer renderer = (TabRenderer) tab.getRenderer(context);
renderer.writeJavaScript(writer, context, tab);
}
}
}
}