gdpPerCapitaField.setCanEdit(false);
gdpPerCapitaField.setAlign(Alignment.RIGHT);
gdpPerCapitaField.setType(ListGridFieldType.FLOAT);
gdpPerCapitaField.setCellFormatter(new CellFormatter() {
public String format(Object value, ListGridRecord record, int rowNum, int colNum) {
CountryRecord countryRecord = (CountryRecord) record;
long gdpPerCapita = Math.round((countryRecord.getGdp() * 1000000000) / countryRecord.getPopulation());
NumberFormat nf = NumberFormat.getFormat("0,000");
return "$" + nf.format(gdpPerCapita);
}
});
gdpPerCapitaField.setSortNormalizer(new SortNormalizer() {
public Object normalize(ListGridRecord record, String fieldName) {
CountryRecord countryRecord = (CountryRecord) record;
return countryRecord.getGdp() / countryRecord.getPopulation();
}
});
countryGrid.addEditorExitHandler(new EditorExitHandler() {
public void onEditorExit(EditorExitEvent event) {