String componentFamily = (String)entry.getKey();
List<RendererBean> renderers = (List<RendererBean>) entry.getValue();
for (Iterator<RendererBean> rendererIter = renderers.iterator();
rendererIter.hasNext();) {
RendererBean renderer = rendererIter.next();
String rendererType = renderer.getRendererType();
writer.startElement("tag");
DescriptionBean description = renderer.getDescription("");
if (description != null) {
String descriptionText = description.getDescription().trim();
if (descriptionText != null) {
writer.startElement("description");
StringBuffer sb = new StringBuffer();
sb.append("<![CDATA[");
sb.append(descriptionText);
sb.append("]]>\n");
writer.writeText(sb.toString());
writer.closeElement();
}
}
String tagName = makeTldTagName(
GeneratorUtil.stripJavaxFacesPrefix(componentFamily),
GeneratorUtil.stripJavaxFacesPrefix(rendererType));
if (tagName == null) {
throw new IllegalStateException(
"Could not determine tag name");
}
writer.startElement("name");
writer.writeText(tagName);
writer.closeElement();
if (GeneratorUtil.makeTagClassName(
GeneratorUtil.stripJavaxFacesPrefix(componentFamily),
GeneratorUtil.stripJavaxFacesPrefix(rendererType)) ==
null) {
throw new IllegalStateException(
"Could not determine tag class name");
}
writer.startElement("tag-class");
writer.writeText(targetPackage + '.' +
GeneratorUtil.makeTagClassName(GeneratorUtil.stripJavaxFacesPrefix(componentFamily),
GeneratorUtil.stripJavaxFacesPrefix(rendererType)));
writer.closeElement();
writer.startElement("body-content");
writer.writeText(getBodyContent(tagName));
writer.closeElement();
// Generate tag attributes
//
// Component Properties first...
//
ComponentBean component = componentsByComponentFamily.get(componentFamily);
PropertyBean[] properties = component.getProperties();
PropertyBean property;
for (int i = 0, len = properties.length; i < len; i++) {
if (null == (property = properties[i])) {
continue;
}
if (!property.isTagAttribute()) {
continue;
}
writer.startElement("attribute");
description = property.getDescription("");
if (description != null) {
String descriptionText =
description.getDescription().trim();
if (descriptionText != null) {
writer.startElement("description");
StringBuffer sb = new StringBuffer();
sb.append("<![CDATA[");
sb.append(descriptionText);
sb.append("]]>\n");
writer.writeText(sb.toString());
writer.closeElement();
}
}
String propertyName = property.getPropertyName();
writer.startElement("name");
writer.writeText(propertyName);
writer.closeElement();
writer.startElement("required");
writer.writeText(property.isRequired() ?
Boolean.TRUE.toString() :
Boolean.FALSE.toString());
writer.closeElement();
if (!"id".equals(propertyName)) {
if (property.isMethodExpressionEnabled()) {
writer.startElement("deferred-method");
writer.startElement("method-signature");
writer.writeText(
property.getMethodSignature());
writer.closeElement(2);
} else if (property.isValueExpressionEnabled()) {
// PENDING FIX ME
String type = property.getPropertyClass();
// String wrapperType = (String)
// GeneratorUtil.convertToPrimitive(type);
// if (wrapperType != null) {
// type = wrapperType;
// }
writer.startElement("deferred-value");
writer.startElement("type");
writer.writeText(type);
writer.closeElement(2);
} else {
writer.startElement("rtexprvalue");
writer.writeText(getRtexprvalue(tagName, propertyName));
writer.closeElement();
}
} else {
writer.startElement("rtexprvalue");
writer.writeText(getRtexprvalue(tagName, propertyName));
writer.closeElement();
}
writer.closeElement(); // closes attribute element above
} // END property FOR loop
// Renderer Attributes Next...
//
AttributeBean[] attributes = renderer.getAttributes();
AttributeBean attribute;
for (int i = 0, len = attributes.length; i < len; i++) {
if (null == (attribute = attributes[i])) {
continue;
}