private void generateRenderersDocs() throws Exception {
StringBuffer sb;
RenderKitBean renderKit;
DescriptionBean descBean;
String description;
String rendererType;
String componentFamily;
String defaultValue;
String title;
// generate the docus for each renderer
if (null == (renderKit = configBean.getRenderKit(renderKitId))) {
RenderKitBean[] kits = configBean.getRenderKits();
if (kits == null) {
throw new IllegalStateException("no RenderKits");
}
renderKit = kits[0];
if (renderKit == null) {
throw new IllegalStateException("no RenderKits");
}
}
RendererBean[] renderers = renderKit.getRenderers();
AttributeBean[] attributes;
sb = new StringBuffer(2048);
for (int i = 0, len = renderers.length; i < len; i++) {
if (null == renderers[i]) {
throw new IllegalStateException("null Renderer at index: " + i);
}
attributes = renderers[i].getAttributes();
sb.append(DOCTYPE + "\n");
sb.append("<html>\n");
sb.append("<head>\n");
// PENDING timestamp
sb.append("<title>\n");
title = "<font size=\"-1\">component-family:</font> " +
(componentFamily = renderers[i].getComponentFamily()) +
" <font size=\"-1\">renderer-type:</font> " +
(rendererType = renderers[i].getRendererType());
sb.append(title + "\n");
sb.append("</title>\n");
// PENDING META tag
sb.append(
"<link REL =\"stylesheet\" TYPE=\"text/css\" HREF=\"../stylesheet.css\" TITLE=\"Style\">\n");
sb.append("</head>\n");
sb.append("<script>\n");
sb.append("function asd()\n");
sb.append("{\n");
sb.append(" parent.document.title=" + title + "\n");
sb.append("}\n");
sb.append("</SCRIPT>\n");
sb.append("<body BGCOLOR=\"white\" onload=\"asd();\">\n");
sb.append("\n");
sb.append("<H2><font size=\"-1\">" + renderKitId +
" render-kit</font>\n");
sb.append("<br />\n");
sb.append(title + "\n");
sb.append("</H2>\n");
sb.append("<HR />\n");
descBean = renderers[i].getDescription("");
description = (null == descBean) ? "" : descBean.getDescription();
sb.append("<P>" + description + "</P>\n");
// render our renders children status
if (renderers[i].isRendersChildren()) {
sb.append(
"<P>This renderer is responsible for rendering its children.</P>");
} else {
sb.append(
"<P>This renderer is not responsible for rendering its children.</P>");
}
// if we have attributes
if ((null == attributes) || (0 < attributes.length)) {
sb.append("<HR />\n");
sb.append("<a NAME=\"attributes\"><!-- --></a>\n");
sb.append("\n");
sb.append("<h3>Note:</h3>\n");
sb.append("\n");
sb.append(
"<p>Attributes with a <code>pass-through</code> value of\n");
sb.append(
"<code>true</code> are not interpreted by the renderer and are passed\n");
sb.append(
"straight through to the rendered markup, without checking for validity. Attributes with a\n");
sb.append(
"<code>pass-through</code> value of <code>false</code> are interpreted\n");
sb.append(
"by the renderer, and may or may not be checked for validity by the renderer.</p>\n");
sb.append("\n");
sb.append(
"<table BORDER=\"1\" CELLPADDING=\"3\" CELLSPACING=\"0\" WIDTH=\"100%\">\n");
sb.append(
"<tr BGCOLOR=\"#CCCCFF\" CLASS=\"TableHeadingColor\">\n");
sb.append("<td COLSPAN=\"5\"><font SIZE=\"+2\">\n");
sb.append("<b>Attributes</b></font></td>\n");
sb.append("</tr>\n");
sb.append(
"<tr BGCOLOR=\"#CCCCFF\" CLASS=\"TableHeadingColor\">\n");
sb.append("<th><b>attribute-name</b></th>\n");
sb.append("<th><b>pass-through</b></th>\n");
sb.append("<th><b>attribute-class</b></th>\n");
sb.append("<th><b>description</b></th>\n");
sb.append("<th><b>default-value</b></th>\n");
sb.append("</tr>\n");
sb.append(" \n");
// output each attribute
if (attributes != null) {
for (int j = 0, attrLen = attributes.length; j < attrLen; j++) {
if (attributes[j].isAttributeIgnoredForRenderer()) {
continue;
}
sb.append(
"<tr BGCOLOR=\"white\" CLASS=\"TableRowColor\">\n");
sb.append(
"<td ALIGN=\"right\" VALIGN=\"top\" WIDTH=\"1%\"><code>\n");
sb.append(
" " + attributes[j].getAttributeName() + "\n");
sb.append("</td>\n");
sb.append("<td ALIGN=\"right\" VALIGN=\"top\">" +
attributes[j].isPassThrough() + "</td>\n");
sb.append("<td><code>" + attributes[j].getAttributeClass() +
"</code></td>\n");
descBean = attributes[j].getDescription("");
description = (null == descBean) ?
"" : descBean.getDescription();
sb.append("<td>" + description + "</td>\n");
if (null ==
(defaultValue = attributes[j].getDefaultValue())) {
defaultValue = "undefined";
}