Example usage for com.google.gwt.user.cellview.client CellList setValueUpdater

List of usage examples for com.google.gwt.user.cellview.client CellList setValueUpdater

Introduction

In this page you can find the example usage for com.google.gwt.user.cellview.client CellList setValueUpdater.

Prototype

public void setValueUpdater(ValueUpdater<T> valueUpdater) 

Source Link

Document

Set the value updater to use when cells modify items.

Usage

From source file:com.google.gwt.examples.cellview.CellListValueUpdaterExample.java

License:Apache License

public void onModuleLoad() {
    // Create a cell that will interact with a value updater.
    TextInputCell inputCell = new TextInputCell();

    // Create a CellList that uses the cell.
    CellList<String> cellList = new CellList<String>(inputCell);

    // Create a value updater that will be called when the value in a cell
    // changes.//w w  w  .jav a 2 s.co  m
    ValueUpdater<String> valueUpdater = new ValueUpdater<String>() {
        public void update(String newValue) {
            Window.alert("You typed: " + newValue);
        }
    };

    // Add the value updater to the cellList.
    cellList.setValueUpdater(valueUpdater);

    // Set the total row count. This isn't strictly necessary, but it affects
    // paging calculations, so its good habit to keep the row count up to date.
    cellList.setRowCount(DAYS.size(), true);

    // Push the data into the widget.
    cellList.setRowData(0, DAYS);

    // Add it to the root panel.
    RootPanel.get().add(cellList);
}