Search in sources :

Example 6 with XmlStringBuilder

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");
}
Also used : XmlStringBuilder(com.github.bordertech.wcomponents.XmlStringBuilder) WHeading(com.github.bordertech.wcomponents.WHeading)

Example 7 with XmlStringBuilder

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");
    }
}
Also used : WHiddenComment(com.github.bordertech.wcomponents.WHiddenComment) XmlStringBuilder(com.github.bordertech.wcomponents.XmlStringBuilder)

Example 8 with XmlStringBuilder

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();
}
Also used : XmlStringBuilder(com.github.bordertech.wcomponents.XmlStringBuilder)

Example 9 with XmlStringBuilder

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();
}
Also used : WImage(com.github.bordertech.wcomponents.WImage) XmlStringBuilder(com.github.bordertech.wcomponents.XmlStringBuilder)

Example 10 with XmlStringBuilder

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");
}
Also used : WInternalLink(com.github.bordertech.wcomponents.WInternalLink) XmlStringBuilder(com.github.bordertech.wcomponents.XmlStringBuilder)

Aggregations

XmlStringBuilder (com.github.bordertech.wcomponents.XmlStringBuilder)102 WComponent (com.github.bordertech.wcomponents.WComponent)30 SystemException (com.github.bordertech.wcomponents.util.SystemException)17 Size (com.github.bordertech.wcomponents.Size)8 Diagnostic (com.github.bordertech.wcomponents.validation.Diagnostic)7 OptionGroup (com.github.bordertech.wcomponents.OptionGroup)6 UIContext (com.github.bordertech.wcomponents.UIContext)5 WPanel (com.github.bordertech.wcomponents.WPanel)5 WebXmlRenderContext (com.github.bordertech.wcomponents.servlet.WebXmlRenderContext)5 WButton (com.github.bordertech.wcomponents.WButton)4 WSuggestions (com.github.bordertech.wcomponents.WSuggestions)4 WTable (com.github.bordertech.wcomponents.WTable)4 WTableColumn (com.github.bordertech.wcomponents.WTableColumn)4 ComponentWithContext (com.github.bordertech.wcomponents.ComponentWithContext)3 TableDataModel (com.github.bordertech.wcomponents.TableDataModel)3 TreeTableDataModel (com.github.bordertech.wcomponents.TreeTableDataModel)3 WDataTable (com.github.bordertech.wcomponents.WDataTable)3 WRepeater (com.github.bordertech.wcomponents.WRepeater)3 TableModel (com.github.bordertech.wcomponents.WTable.TableModel)3 AjaxOperation (com.github.bordertech.wcomponents.AjaxOperation)2