Example usage for com.google.gwt.gen2.table.client AbstractColumnDefinition getCellValue

List of usage examples for com.google.gwt.gen2.table.client AbstractColumnDefinition getCellValue

Introduction

In this page you can find the example usage for com.google.gwt.gen2.table.client AbstractColumnDefinition getCellValue.

Prototype

public abstract ColType getCellValue(RowType rowValue);

Source Link

Usage

From source file:org.kuali.student.common.ui.client.widgets.pagetable.PagingScrollTableBuilder.java

License:Educational Community License

/**
 * This method builds the table model. Call at the end of the builder method chain.
 * Required/* ww w  .j a  v  a2 s.c o m*/
 *
 *
 * @return the built pagingScrollTable
 */
@SuppressWarnings("unchecked") //columnDef cast
public PagingScrollTable<RowType> build(GenericTableModel tableModel) {
    DefaultTableDefinition<RowType> tableDefinition = new DefaultTableDefinition<RowType>();
    if (columnDefs != null) {
        for (AbstractColumnDefinition columnDef : columnDefs) {
            columnPixelWidths.add(columnDef.getPreferredColumnWidth());
            CellRenderer renderer = new CellRenderer() {

                @Override
                public void renderRowValue(Object rowValue, ColumnDefinition columnDef, AbstractCellView view) {
                    if (rowValue != null && rowValue instanceof ResultRow) {
                        view.setHTML((String) columnDef.getCellValue(rowValue));
                    }
                }

            };
            columnDef.setCellRenderer(renderer);
            tableDefinition.addColumnDefinition(columnDef);
        }
    }

    if (isPagable) {
        pagingScrollTable = new PagingScrollTable<RowType>(
                tableModel.createCachedTableModel(numPageRows, numPages), tableDefinition);
        pagingScrollTable.setPageSize(numPageRows);

    } else {
        pagingScrollTable = new PagingScrollTable<RowType>(tableModel, tableDefinition);
        pagingScrollTable.setPageSize(tableModel.getRowCount());
    }
    pagingScrollTable.setPixelSize(tablePixelWidth, tablePixelHeight);//FIXME workaround for incubator bug   [KSCOR-225] This table to be replaced in M6
    pagingScrollTable.setEmptyTableWidget(new HTML("There is no data to display"));

    pagingScrollTable.getDataTable().setSelectionPolicy(selectionPolicy);

    pagingScrollTable.getHeaderTable().setWidth("100%");
    pagingScrollTable.getDataTable().setWidth("100%");

    return this.pagingScrollTable;
}