Labels in OpenXava are specified in i18n files. But what if I need to change the label in runtime depending on some logic, from an action for example.
Let's say I have an entity with a profit property, but if the property value is negative I want to change the label from "Profit" to "Loss". Like in this action code:
public void execute() throws Exception {
// ...
BigDecimal profit = (BigDecimal) getView().getValue("profit");
if (profit.compareTo(BigDecimal.ZERO) < 0) {
// Here I want to change the label of profit from "Profit" to "Loss"
}
}