Unfortunately, the Table does not have an API to get the value of the generated cell.
I suggest creating a transient, meta property for this generated column.
Add grade meta property to Customer entity
@Transient
@MetaProperty
protected Integer grade;
Add generator for the grade column
public Component generateGrade(Customer entity) {
CustomerGrade customerGrade = CustomerGrade.fromId(10);
entity.setGrade(customerGrade);
return new Table.PlainTextCell(customerGrade.name());
}
Add a style provider for the grade column
@Install(to = "table", subject = "styleProvider")
protected String customerTableStyleProvider(Customer customer, String property) {
if (property == null) {
// style for row
} else if (property.equals("grade")) {
switch (customer.getGrade()) {
case PREMIUM:
return "premium-grade";
case HIGH:
return "high-grade";
case MEDIUM:
return "medium-grade";
}
}
return null;
}