SmartField.execValidateValue cannot be used [message #1065592] |
Wed, 26 June 2013 11:30  |
Eclipse User |
|
|
|
I have a smart field which I use to select items that are then added to a table.
I wanted to check if the currently selected value in the smart field is already in the table and on the one hand disable the "add to table" button, show an error message on the smartfield and clear the value from the smart field.
The first two, I could do in the execChangedValue() method, but trying to do setValue(null) in execChangedValue() doesn't work (loop detection).
So I though I'd use execValidateValue instead. However, SmartField.execValidateValue() is final and can't be overwritten. In this case, I find it strange that the SDK offers me the possibility to overwrite this function.
Is there a deeper reasoning behind this or should I file a bug?
And if anyone has a suggestion how to have my smartfield set to null in the above case, I'd appreciate any hints.
|
|
|
|
|
|
|
|
|
Re: SmartField.execValidateValue cannot be used [message #1065752 is a reply to message #1065697] |
Thu, 27 June 2013 07:35  |
Eclipse User |
|
|
|
I've had a look at execFilterLookupResult() and I've found an even better solution than removing entries already in the table: If a key is already contained in the table, then instead of removing this entry, I'm keeping it in the result list but set it to disabled, to make it clear that it is already in the table.
@Override
protected void execFilterLookupResult(LookupCall call, List<LookupRow> result) throws ProcessingException {
ITable table = getMappingTableField().getTable();
for (LookupRow row : result) {
if (table.findRowByKey(new Object[] { row.getKey() }) != null) {
row.setIconId(Icons.MarkedError);
row.setEnabled(false);
} else {
row.setIconId(Icons.Empty);
}
}
}
Thanks for your help on this!
|
|
|
Powered by
FUDForum. Page generated in 0.04181 seconds