Search in sources :

Example 1 with WEditableImage

use of com.github.bordertech.wcomponents.WEditableImage in project wcomponents by BorderTech.

the class WEditableImageRenderer method doRender.

/**
 * Paints the given {@link WEditableImage}.
 *
 * @param component the WEditableImage to paint.
 * @param renderContext the RenderContext to paint to.
 */
@Override
public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
    WEditableImage editableImage = (WEditableImage) component;
    XmlStringBuilder xml = renderContext.getWriter();
    // No image set
    if (editableImage.getImage() == null && editableImage.getImageUrl() == null) {
        return;
    }
    WImageRenderer.renderTagOpen(editableImage, xml);
    WComponent uploader = editableImage.getEditUploader();
    if (uploader != null) {
        xml.appendAttribute("data-wc-editor", uploader.getId());
    }
    xml.appendEnd();
}
Also used : WComponent(com.github.bordertech.wcomponents.WComponent) WEditableImage(com.github.bordertech.wcomponents.WEditableImage) XmlStringBuilder(com.github.bordertech.wcomponents.XmlStringBuilder)

Aggregations

WComponent (com.github.bordertech.wcomponents.WComponent)1 WEditableImage (com.github.bordertech.wcomponents.WEditableImage)1 XmlStringBuilder (com.github.bordertech.wcomponents.XmlStringBuilder)1