Search in sources :

Example 31 with TableModel

use of com.github.bordertech.wcomponents.WTable.TableModel in project wcomponents by BorderTech.

the class WTableRenderer method paintRows.

/**
 * Paints the rows of the table.
 *
 * @param table the table to paint the rows for.
 * @param renderContext the RenderContext to paint to.
 */
private void paintRows(final WTable table, final WebXmlRenderContext renderContext) {
    XmlStringBuilder xml = renderContext.getWriter();
    TableModel model = table.getTableModel();
    xml.appendTagOpen("ui:tbody");
    xml.appendAttribute("id", table.getId() + ".body");
    xml.appendClose();
    if (model.getRowCount() == 0) {
        xml.appendTag("ui:nodata");
        xml.appendEscaped(table.getNoDataMessage());
        xml.appendEndTag("ui:nodata");
    } else {
        // If has at least one visible col, paint the rows.
        final int columnCount = table.getColumnCount();
        for (int i = 0; i < columnCount; i++) {
            if (table.getColumn(i).isVisible()) {
                doPaintRows(table, renderContext);
                break;
            }
        }
    }
    xml.appendEndTag("ui:tbody");
}
Also used : XmlStringBuilder(com.github.bordertech.wcomponents.XmlStringBuilder) TableModel(com.github.bordertech.wcomponents.WTable.TableModel)

Aggregations

TableModel (com.github.bordertech.wcomponents.WTable.TableModel)31 WTableColumn (com.github.bordertech.wcomponents.WTableColumn)27 WTable (com.github.bordertech.wcomponents.WTable)26 AdapterBasicTableModel (com.github.bordertech.wcomponents.AdapterBasicTableModel)24 SimpleTableModel (com.github.bordertech.wcomponents.SimpleTableModel)24 Test (org.junit.Test)24 WTextField (com.github.bordertech.wcomponents.WTextField)23 XmlStringBuilder (com.github.bordertech.wcomponents.XmlStringBuilder)5 WButton (com.github.bordertech.wcomponents.WButton)4 ActionConstraint (com.github.bordertech.wcomponents.WTable.ActionConstraint)4 UIContext (com.github.bordertech.wcomponents.UIContext)2 RowIdWrapper (com.github.bordertech.wcomponents.WTable.RowIdWrapper)2 WText (com.github.bordertech.wcomponents.WText)2 ArrayList (java.util.ArrayList)2 WComponent (com.github.bordertech.wcomponents.WComponent)1 WRepeater (com.github.bordertech.wcomponents.WRepeater)1 WTableRowRenderer (com.github.bordertech.wcomponents.WTableRowRenderer)1 SystemException (com.github.bordertech.wcomponents.util.SystemException)1 MockRequest (com.github.bordertech.wcomponents.util.mock.MockRequest)1