use of com.github.bordertech.wcomponents.XmlStringBuilder in project wcomponents by BorderTech.
the class WHeadingRenderer method doRender.
/**
* Paints the given WHeading.
*
* @param component the WHeading to paint.
* @param renderContext the RenderContext to paint to.
*/
@Override
public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
WHeading heading = (WHeading) component;
XmlStringBuilder xml = renderContext.getWriter();
xml.appendTagOpen("ui:heading");
xml.appendAttribute("id", component.getId());
xml.appendOptionalAttribute("class", component.getHtmlClass());
xml.appendOptionalAttribute("track", component.isTracking(), "true");
xml.appendAttribute("level", heading.getHeadingLevel().getLevel());
xml.appendOptionalAttribute("accessibleText", heading.getAccessibleText());
xml.appendClose();
// Render margin
MarginRendererUtil.renderMargin(heading, renderContext);
if (heading.getDecoratedLabel() == null) {
// Constructed with a String
xml.append(heading.getText(), heading.isEncodeText());
} else {
heading.getDecoratedLabel().paint(renderContext);
}
xml.appendEndTag("ui:heading");
}
use of com.github.bordertech.wcomponents.XmlStringBuilder in project wcomponents by BorderTech.
the class WHiddenCommentRenderer method doRender.
/**
* Paints the given WHiddenComment.
*
* @param component the WHiddenComment to paint.
* @param renderContext the RenderContext to paint to.
*/
@Override
public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
WHiddenComment hiddenComponent = (WHiddenComment) component;
XmlStringBuilder xml = renderContext.getWriter();
String hiddenText = hiddenComponent.getText();
if (!Util.empty(hiddenText)) {
xml.appendTag("ui:comment");
xml.appendEscaped(hiddenText);
xml.appendEndTag("ui:comment");
}
}
use of com.github.bordertech.wcomponents.XmlStringBuilder in project wcomponents by BorderTech.
the class WHorizontalRuleRenderer method doRender.
/**
* Paints the given WHorizontalRule.
*
* @param component the WHorizontalRule to paint.
* @param renderContext the RenderContext to paint to.
*/
@Override
public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
XmlStringBuilder xml = renderContext.getWriter();
xml.appendTagOpen("hr");
xml.appendOptionalAttribute("class", component.getHtmlClass());
xml.appendEnd();
}
use of com.github.bordertech.wcomponents.XmlStringBuilder in project wcomponents by BorderTech.
the class WImageRenderer method doRender.
/**
* Paints the given {@link WImage}.
*
* @param component the WImage to paint.
* @param renderContext the RenderContext to paint to.
*/
@Override
public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
WImage imageComponent = (WImage) component;
XmlStringBuilder xml = renderContext.getWriter();
// No image set
if (imageComponent.getImage() == null && imageComponent.getImageUrl() == null) {
return;
}
renderTagOpen(imageComponent, xml);
xml.appendEnd();
}
use of com.github.bordertech.wcomponents.XmlStringBuilder in project wcomponents by BorderTech.
the class WInternalLinkRenderer method doRender.
/**
* Paints the given {@link WInternalLink}.
*
* @param component the WInternalLink to paint.
* @param renderContext the RenderContext to paint to.
*/
@Override
public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
WInternalLink link = (WInternalLink) component;
XmlStringBuilder xml = renderContext.getWriter();
if (Util.empty(link.getText())) {
return;
}
xml.appendTagOpen("ui:link");
xml.appendAttribute("id", component.getId());
xml.appendOptionalAttribute("class", component.getHtmlClass());
xml.appendOptionalAttribute("track", component.isTracking(), "true");
xml.appendOptionalAttribute("toolTip", link.getToolTip());
xml.appendOptionalAttribute("accessibleText", link.getAccessibleText());
xml.appendUrlAttribute("url", "#" + link.getReference().getId());
xml.appendClose();
xml.appendEscaped(link.getText());
xml.appendEndTag("ui:link");
}
Aggregations