use of com.github.bordertech.wcomponents.WFieldSet in project wcomponents by BorderTech.
the class WFieldSetRenderer method doRender.
/**
* Paints the given WFieldSet.
*
* @param component the WFieldSet to paint.
* @param renderContext the RenderContext to paint to.
*/
@Override
public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
WFieldSet fieldSet = (WFieldSet) component;
XmlStringBuilder xml = renderContext.getWriter();
xml.appendTagOpen("ui:fieldset");
xml.appendAttribute("id", component.getId());
xml.appendOptionalAttribute("class", component.getHtmlClass());
xml.appendOptionalAttribute("track", component.isTracking(), "true");
xml.appendOptionalAttribute("hidden", fieldSet.isHidden(), "true");
switch(fieldSet.getFrameType()) {
case NO_BORDER:
xml.appendOptionalAttribute("frame", "noborder");
break;
case NO_TEXT:
xml.appendOptionalAttribute("frame", "notext");
break;
case NONE:
xml.appendOptionalAttribute("frame", "none");
break;
case NORMAL:
default:
break;
}
xml.appendOptionalAttribute("required", fieldSet.isMandatory(), "true");
xml.appendClose();
// Render margin
MarginRendererUtil.renderMargin(fieldSet, renderContext);
// Label
WDecoratedLabel label = fieldSet.getTitle();
label.paint(renderContext);
// Children
xml.appendTag("ui:content");
int size = fieldSet.getChildCount();
for (int i = 0; i < size; i++) {
WComponent child = fieldSet.getChildAt(i);
// Skip label, as it has already been painted
if (child != label) {
child.paint(renderContext);
}
}
xml.appendEndTag("ui:content");
DiagnosticRenderUtil.renderDiagnostics(fieldSet, renderContext);
xml.appendEndTag("ui:fieldset");
}
use of com.github.bordertech.wcomponents.WFieldSet in project wcomponents by BorderTech.
the class WLabelRenderer_Test method testWhatForGroupWFieldSet.
@Test
public void testWhatForGroupWFieldSet() throws IOException, SAXException, XpathException {
WFieldSet comp = new WFieldSet("legend");
WLabel label = new WLabel("label", comp);
assertXpathEvaluatesTo("group", "//ui:label/@what", label);
}
Aggregations