Search in sources :

Example 1 with Alignment

use of com.github.bordertech.wcomponents.WTableColumn.Alignment in project wcomponents by BorderTech.

the class WTableRenderer method paintColumnHeading.

/**
 * Paints a single column heading.
 *
 * @param col the column to paint.
 * @param sortable true if the column is sortable, false otherwise
 * @param renderContext the RenderContext to paint to.
 */
private void paintColumnHeading(final WTableColumn col, final boolean sortable, final WebXmlRenderContext renderContext) {
    XmlStringBuilder xml = renderContext.getWriter();
    int width = col.getWidth();
    Alignment align = col.getAlign();
    xml.appendTagOpen("ui:th");
    xml.appendOptionalAttribute("width", width > 0, width);
    xml.appendOptionalAttribute("sortable", sortable, "true");
    if (Alignment.RIGHT.equals(align)) {
        xml.appendAttribute("align", "right");
    } else if (Alignment.CENTER.equals(align)) {
        xml.appendAttribute("align", "center");
    }
    xml.appendClose();
    col.paint(renderContext);
    xml.appendEndTag("ui:th");
}
Also used : Alignment(com.github.bordertech.wcomponents.WTableColumn.Alignment) XmlStringBuilder(com.github.bordertech.wcomponents.XmlStringBuilder)

Example 2 with Alignment

use of com.github.bordertech.wcomponents.WTableColumn.Alignment in project wcomponents by BorderTech.

the class WDataTableRenderer method paintColumnHeading.

/**
 * Paints a single column heading.
 *
 * @param col the column to paint.
 * @param sortable true if the column is sortable, false otherwise
 * @param renderContext the RenderContext to paint to.
 */
private void paintColumnHeading(final WTableColumn col, final boolean sortable, final WebXmlRenderContext renderContext) {
    XmlStringBuilder xml = renderContext.getWriter();
    int width = col.getWidth();
    Alignment align = col.getAlign();
    xml.appendTagOpen("ui:th");
    xml.appendOptionalAttribute("width", width > 0, width);
    xml.appendOptionalAttribute("sortable", sortable, "true");
    if (Alignment.RIGHT.equals(align)) {
        xml.appendAttribute("align", "right");
    } else if (Alignment.CENTER.equals(align)) {
        xml.appendAttribute("align", "center");
    }
    xml.appendClose();
    col.paint(renderContext);
    xml.appendEndTag("ui:th");
}
Also used : Alignment(com.github.bordertech.wcomponents.WTableColumn.Alignment) XmlStringBuilder(com.github.bordertech.wcomponents.XmlStringBuilder)

Aggregations

Alignment (com.github.bordertech.wcomponents.WTableColumn.Alignment)2 XmlStringBuilder (com.github.bordertech.wcomponents.XmlStringBuilder)2