Example usage for com.google.gwt.gen2.table.client FixedWidthGrid setText

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

Introduction

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

Prototype

@Override
    public void setText(int row, int column, String text) 

Source Link

Usage

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

License:Apache License

/**
 * Add a row of data cells each consisting of a string that describes the
 * row:column coordinates of the new cell. The number of columns in the new
 * row will match the number of columns in the grid.
 * //from w ww. j  ava2s  .  c  o  m
 * @param beforeRow the index to add the new row into
 */
public void insertDataRow(int beforeRow) {
    // Insert the new row
    FixedWidthGrid dataTable = getDataTable();
    beforeRow = dataTable.insertRow(beforeRow);

    // Set the data in the new row
    Student student = STUDENT_DATA.generateStudent();
    dataTable.setText(beforeRow, 0, student.getFirstName());
    dataTable.setText(beforeRow, 1, student.getLastName());
    dataTable.setText(beforeRow, 2, student.getAge() + "");
    dataTable.setText(beforeRow, 3, student.isMale() ? "male" : "female");
    dataTable.setText(beforeRow, 4, student.getRace());
    String color = student.getFavoriteColor();
    String colorHtml = "<FONT color=\"" + color + "\">" + color + "</FONT>";
    dataTable.setHTML(beforeRow, 5, colorHtml);
    dataTable.setText(beforeRow, 6, student.getFavoriteSport());
    dataTable.setText(beforeRow, 7, student.getCollege());
    dataTable.setText(beforeRow, 8, student.getGraduationYear() + "");
    String gpa = student.getGpa() + "";
    if (gpa.length() > 4) {
        gpa = gpa.substring(0, 4);
    }
    dataTable.setText(beforeRow, 9, gpa);
    dataTable.setText(beforeRow, 10, student.getId() + "");
    dataTable.setText(beforeRow, 11, student.getPin() + "");
}