In recent version of CUBA there is a new feature added to change the focus to specific column of the record as follows that works nicely in many cases.
orderLineTable.requestFocus(line, "requestedDeliveryDate");
Now I want to add a Validator/listener in the table column based on the content of another column. I am trying something like this but seems not right…
orderLineDs.addItemPropertyChangeListener(e -> {
if ("account".equals(e.getProperty())) {
if (e.getItem().getAccount().getHavingSubAccount() == Boolean.TRUE) {
// set focus on the first cell of the added row
bankTranLineTable.requestFocus(e.getItem(), "accountSub");
}
} else if ("accountSub".equals(e.getProperty())) {
if (e.getItem().getAccount().getHavingSubAccount() == Boolean.TRUE) {
if (e.getItem().getAccountSub() == null) {
showMessageDialog("Incorrect Data entry", "Please select the sub-account", MessageType.WARNING);
}
}
In this case, the focus is not moving from Account to AccountSub when I press the Tab button for example. This might be because of using ItemPropertyChangeListener. Any suggested listener I should use so that even the item is not changed, this works for validation?