Column column = new Column("name");
column.setSortable(false);
column.setDecorator(new Decorator() {
public String render(Object row, Context context) {
Customer customer = (Customer) row;
String email = customer.getEmail();
String name = customer.getName();
return "<a href='mailto:" + email + "'>" + name + "</a>";
}
});
table.addColumn(column);
column = new Column("investments");
column.setAutolink(true);
table.addColumn(column);
column = new Column("holdings");
column.setFormat("${0,number,#,##0.00}");
column.setTextAlign("right");
table.addColumn(column);
viewLink.setTitle("View customer details");
editLink.setListener(this, "onEditClick");
editLink.setTitle("Edit customer details");
editLink.setParameter("referrer", "/table/table-decorator.htm");
deleteLink.setTitle("Delete customer record");
deleteLink.setAttribute("onclick", "return window.confirm('Are you sure you want to delete this record?');");
column = new Column("Action");
column.setDecorator(new Decorator() {
public String render(Object row, Context context) {
Customer customer = (Customer) row;
String id = String.valueOf(customer.getId());
viewLink.setValue(id);
editLink.setParameter("id", id);
deleteLink.setValue(id);