Example usage for com.google.gwt.gen2.table.client PagingScrollTable PagingScrollTable

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

Introduction

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

Prototype

public PagingScrollTable(TableModel<RowType> tableModel, TableDefinition<RowType> tableDefinition) 

Source Link

Document

Construct a new PagingScrollTable .

Usage

From source file:com.google.gwt.gen2.demo.scrolltable.client.PagingScrollTableDemo.java

License:Apache License

@Override
protected AbstractScrollTable createScrollTable() {
    // Setup the controller
    tableModel = new DataSourceTableModel();
    cachedTableModel = new CachedTableModel<Student>(tableModel);
    cachedTableModel.setPreCachedRowCount(50);
    cachedTableModel.setPostCachedRowCount(50);
    cachedTableModel.setRowCount(1000);//from  w  ww. j  av a 2 s .c o  m

    // Create a TableCellRenderer
    TableDefinition<Student> tableDef = createTableDefinition();

    // Create the scroll table
    pagingScrollTable = new PagingScrollTable<Student>(cachedTableModel, tableDef);
    pagingScrollTable.setPageSize(50);
    pagingScrollTable.setEmptyTableWidget(new HTML("There is no data to display"));

    // Setup the bulk renderer
    FixedWidthGridBulkRenderer<Student> bulkRenderer = new FixedWidthGridBulkRenderer<Student>(
            pagingScrollTable.getDataTable(), pagingScrollTable);
    pagingScrollTable.setBulkRenderer(bulkRenderer);

    // Setup the formatting
    pagingScrollTable.setCellPadding(3);
    pagingScrollTable.setCellSpacing(0);
    pagingScrollTable.setResizePolicy(ScrollTable.ResizePolicy.FILL_WIDTH);

    return pagingScrollTable;
}

From source file:org.gss_project.gss.admin.client.ui.FilesTable.java

License:Open Source License

/**
 * Initializes the scroll table// ww w  .  j  a  va2  s.c o m
 * @return
 */
private PagingScrollTable<FileHeaderDTO> createScrollTable() {
    // create our own table model
    tableModel = new DataSourceTableModel();
    // add it to cached table model
    cachedTableModel = createCachedTableModel(tableModel);

    // create the table definition
    TableDefinition<FileHeaderDTO> tableDef = createTableDefinition();

    // create the paging scroll table
    pagingScrollTable = new PagingScrollTable<FileHeaderDTO>(cachedTableModel, tableDef);
    pagingScrollTable.setPageSize(10);
    pagingScrollTable.setEmptyTableWidget(new HTML("There is no data to display"));
    pagingScrollTable.getDataTable().setSelectionPolicy(SelectionPolicy.ONE_ROW);

    FixedWidthGridBulkRenderer<FileHeaderDTO> bulkRenderer = new FixedWidthGridBulkRenderer<FileHeaderDTO>(
            pagingScrollTable.getDataTable(), pagingScrollTable);
    pagingScrollTable.setBulkRenderer(bulkRenderer);

    pagingScrollTable.setCellPadding(3);
    pagingScrollTable.setCellSpacing(0);
    pagingScrollTable.setResizePolicy(ScrollTable.ResizePolicy.FILL_WIDTH);

    pagingScrollTable.setSortPolicy(SortPolicy.SINGLE_CELL);

    return pagingScrollTable;
}

From source file:org.gss_project.gss.admin.client.ui.UsersTable.java

License:Open Source License

/**
 * Initializes the scroll table//from w w w.  j  a v a2  s  .c  om
 * @return
 */
private PagingScrollTable<UserDTO> createScrollTable() {
    // create our own table model
    tableModel = new DataSourceTableModel();
    // add it to cached table model
    cachedTableModel = createCachedTableModel(tableModel);

    // create the table definition
    TableDefinition<UserDTO> tableDef = createTableDefinition();

    // create the paging scroll table
    pagingScrollTable = new PagingScrollTable<UserDTO>(cachedTableModel, tableDef);
    pagingScrollTable.setPageSize(10);
    pagingScrollTable.setEmptyTableWidget(new HTML("There is no data to display"));
    pagingScrollTable.getDataTable().setSelectionPolicy(SelectionPolicy.ONE_ROW);

    FixedWidthGridBulkRenderer<UserDTO> bulkRenderer = new FixedWidthGridBulkRenderer<UserDTO>(
            pagingScrollTable.getDataTable(), pagingScrollTable);
    pagingScrollTable.setBulkRenderer(bulkRenderer);

    pagingScrollTable.setCellPadding(3);
    pagingScrollTable.setCellSpacing(0);
    pagingScrollTable.setResizePolicy(ScrollTable.ResizePolicy.FILL_WIDTH);

    pagingScrollTable.setSortPolicy(SortPolicy.SINGLE_CELL);

    return pagingScrollTable;
}

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/*from   ww  w.  j a v a2 s. c om*/
 *
 *
 * @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;
}