Example usage for com.google.gwt.widgetideas.table.client PreloadedTable PreloadedTable

List of usage examples for com.google.gwt.widgetideas.table.client PreloadedTable PreloadedTable

Introduction

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

Prototype

PreloadedTable

Source Link

Usage

From source file:com.google.gwt.demos.bulkloadingtable.client.BulkLoadingTableDemo.java

License:Apache License

public void onModuleLoad() {

    panel = new VerticalPanel();
    RootPanel.get().add(panel);// ww w. j a  va 2  s . c om
    panel.add(
            new HTML("<h2>A very boring demo showing the speed difference of using bulk loading tables.</h2>"));
    panel.add(new Label("Number of rows"));
    final TextBox rows = new TextBox();
    panel.add(rows);
    rows.setText(numRows + "");
    rows.addChangeListener(new ChangeListener() {
        public void onChange(Widget sender) {
            numRows = Integer.parseInt(rows.getText().trim());
        }
    });

    panel.add(new Label("Number of columns"));
    final TextBox columns = new TextBox();
    panel.add(columns);
    columns.addChangeListener(new ChangeListener() {

        public void onChange(Widget sender) {
            numColumns = Integer.parseInt(columns.getText());
        }
    });
    columns.setText(numColumns + "");

    panel.add(new HTML(
            "<p/><p/><b>Clear Table now </b> (clearing will also happen if the buttons are clicked below)"));
    panel.add(new Button("Go", new ClickListener() {

        public void onClick(Widget sender) {
            clearTable();
        }

    }));

    panel.add(new HTML("<p/><p/><b> Use the traditional FlexTable API</b>"));
    Button flexTableAPI = new Button("Go", new ClickListener() {

        public void onClick(Widget sender) {
            clearTable();
            long milli = System.currentTimeMillis();
            FlexTable newTable = new FlexTable();
            usingFlexTableAPI(newTable);
            finishTable(newTable, milli);
        }
    });
    panel.add(flexTableAPI);

    panel.add(new HTML("<p/><p/><b> Use the traditional Grid API</b>"));
    Button gridAPI = new Button("Go", new ClickListener() {
        public void onClick(Widget sender) {
            clearTable();
            long milli = System.currentTimeMillis();
            Grid newTable = new Grid();
            usingGridAPI(newTable);
            finishTable(newTable, milli);
        }

    });
    panel.add(gridAPI);

    panel.add(new HTML("<p/><p/><b> Use the attached Grid API</b>"));
    Button detachedGridAPI = new Button("Go", new ClickListener() {
        public void onClick(Widget sender) {
            clearTable();

            long milli = System.currentTimeMillis();
            Grid table = new Grid();
            curTable = table;
            table.setBorderWidth(2);
            panel.add(table);
            usingGridAPI(table);
            log("Finished in " + (System.currentTimeMillis() - milli) + " milliseconds");
        }

    });
    panel.add(detachedGridAPI);

    panel.add(new HTML("<p/><p/><b> Use Async BulkLoadedTable API</b>"));
    Button asyncAPI = new Button("Go", new ClickListener() {
        public void onClick(Widget sender) {
            clearTable();
            long milli = System.currentTimeMillis();
            FlexTable table = new FlexTable();
            usingBulkLoadedTableAPI(table, milli);
        }
    });

    panel.add(asyncAPI);

    panel.add(new HTML("<p/><p/><b> Use the PreloadedTable  API</b>"));
    Button pendingAPI = new Button("Go", new ClickListener() {

        public void onClick(Widget sender) {
            clearTable();
            long milli = System.currentTimeMillis();
            PreloadedTable table = new PreloadedTable();
            usingPreloadedTableAPI(table);
            finishTable(table, milli);
        }

    });
    panel.add(pendingAPI);
}

From source file:org.sonar.gwt.ui.SourcePanel.java

License:Open Source License

private void createRowsTable() {
    if (rowsTable == null) {
        rowsTable = new PreloadedTable();
        rowsTable.setStyleName("sources code");

        offset = source.getLinesById().firstKey();
        if (shouldDecorateLine(0)) {
            List<Row> rows = decorateLine(0, null);
            if (rows != null) {
                for (Row row : rows) {
                    rowsTable.setPendingHTML(currentRow, 0, row.getColumn1());
                    rowsTable.setPendingHTML(currentRow, 1, row.getColumn2());
                    rowsTable.setPendingHTML(currentRow, 2, row.getColumn3());
                    rowsTable.setPendingHTML(currentRow, 3, row.getColumn4());
                    currentRow++;/*  ww  w  .j  av  a 2  s  .com*/
                }
            }
        }
    }
}