PDA

View Full Version : [ENHANCEMENT] Field.onBlur() repeatedly calls getValue



Curt Arnold
9 Jun 2009, 1:27 PM
In Field.onBlur() is the following fragment:

if ((focusValue == null && getValue() != null)
|| (focusValue != null && !focusValue.equals(getValue()))) {
fireChangeEvent(focusValue, getValue());
}


getValue() is called 3 times where it could be called just once with:

Object currentValue = getValue();
if ((focusValue == null && currentValue != null)
|| (focusValue != null && !focusValue.equals(currentValue))) {
fireChangeEvent(focusValue, currentValue);
}

Inconsequential when getValue() is trivial. I've got a pretty complicated getValue() in a custom class and I'm not sure that it is consequential there, but no reason to do unnecessary work.

Curt Arnold
9 Jun 2009, 1:29 PM
Okay, getValue() is only called twice, but that still one more than necessary.

Code fragment from 2.0 M2.

sven
9 Jun 2009, 1:41 PM
Thanks for investigating. Will be changed with my next commit.

sven
9 Jun 2009, 4:53 PM
Changed in SVN