SUGGESTED FIX
------- KeyboardFocusManager.java -------
*** /tmp/sccs.R2aqSo Wed Jul 28 19:22:11 2004
--- KeyboardFocusManager.java Wed Jul 28 12:53:07 2004
***************
*** 1369,1379 ****
* @param propertyName the name of the property that has changed
* @param oldValue the property's previous value
* @param newValue the property's new value
*/
protected void firePropertyChange(String propertyName, Object oldValue,
! Object newValue) {
PropertyChangeSupport changeSupport = this.changeSupport;
if (changeSupport != null) {
changeSupport.firePropertyChange(propertyName, oldValue, newValue);
}
}
--- 1369,1383 ----
* @param propertyName the name of the property that has changed
* @param oldValue the property's previous value
* @param newValue the property's new value
*/
protected void firePropertyChange(String propertyName, Object oldValue,
! Object newValue)
! {
! if (oldValue == newValue) {
! return;
! }
PropertyChangeSupport changeSupport = this.changeSupport;
if (changeSupport != null) {
changeSupport.firePropertyChange(propertyName, oldValue, newValue);
}
}
***************
*** 1545,1554 ****
--- 1549,1561 ----
*/
protected void fireVetoableChange(String propertyName, Object oldValue,
Object newValue)
throws PropertyVetoException
{
+ if (oldValue == newValue) {
+ return;
+ }
VetoableChangeSupport vetoableSupport =
this.vetoableSupport;
if (vetoableSupport != null) {
vetoableSupport.fireVetoableChange(propertyName, oldValue,
newValue);
###@###.### 08/13/2004
###@###.### 2004-08-13
|
EVALUATION
Name: aaR10319 Date: 07/15/2004
in the application listed focus events are:
1. at startup - FOCUS_GAINED on "One" (opposite is null)
2. when user hits Tab - FOCUS_LOST on "One" (opposite is "Two"), after
it focusOwner and permanentFocusOwner become null
3. FOCUS_GAINED on "Two" (opposite is "One") - that is vetoed, so
focusOwner becomes "One" and permanentFocusOwner = null
4. because of veto - FOCUS_LOST on "Two" (opposite is One), focusOwner
and permanentFocusOwner become null
5. FOCUS_GAINED on "One" (opposite is "Two"), focusOwner and
permanentFocusOwner become "One"
All the changes to permanentFocusOwner property cause user notification,
so in the 4. notification will be the vetoableChange with both old and
new values set null.
As a possible solution we probably should not generate vetoable
PropertyChangeEvent if old and new values are equal. And users would
better veto either both focusOwner and permanentFocusOwner properties or
none of them, though this is not a requirement
###@###.###
======================================================================
Name: at153223 Date: 07/26/2004
The problem is that the case when old and new property values are null
is considered by PropertyChangeSupport class to require notification.
Though in case of focusOwner property we don't have to be notified.
###@###.### 07/26/2004
======================================================================
Name: at153223 Date: 07/28/2004
Suggested fix (see also Artem's evaluation above) is to test if an old and
new property values are the same ('null' and 'null' case is included) not relying
on PropertyChangeSupport checking.
###@###.### 07/28/2004
======================================================================
|