cellTable.addColumn(checkColumn, SafeHtmlUtils.fromSafeConstant("<br/>"));
cellTable.setColumnWidth(checkColumn, 40, Unit.PX);
// First name.
Column<ContactInfo, String> firstNameColumn = new Column<ContactInfo, String>(
new EditTextCell()) {
@Override
public String getValue(ContactInfo object) {
return object.getFirstName();
}
};
firstNameColumn.setSortable(true);
sortHandler.setComparator(firstNameColumn, new Comparator<ContactInfo>() {
public int compare(ContactInfo o1, ContactInfo o2) {
return o1.getFirstName().compareTo(o2.getFirstName());
}
});
cellTable.addColumn(firstNameColumn, constants.cwCellTableColumnFirstName());
firstNameColumn.setFieldUpdater(new FieldUpdater<ContactInfo, String>() {
public void update(int index, ContactInfo object, String value) {
// Called when the user changes the value.
object.setFirstName(value);
ContactDatabase.get().refreshDisplays();
}
});
cellTable.setColumnWidth(firstNameColumn, 20, Unit.PCT);
// Last name.
Column<ContactInfo, String> lastNameColumn = new Column<ContactInfo, String>(
new EditTextCell()) {
@Override
public String getValue(ContactInfo object) {
return object.getLastName();
}
};