harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Evgeniya Maenkova (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HARMONY-2647) [classlib][swing] javax.swing.text.JTextComponent focusAcceleratorKey property has invalid name
Date Thu, 08 Feb 2007 19:13:05 GMT

    [ https://issues.apache.org/jira/browse/HARMONY-2647?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12471445
] 

Evgeniya Maenkova commented on HARMONY-2647:
--------------------------------------------

I believe, it appears as some time ago both field name and property change event name were
the same - "focusAcceleraterKey". See http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4341002,
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4177283.

Then property name was changed and field name was left.  Looks like this mess comes from there.

It would be logically to have field name as "focusAccelerator", as it's declared as "bound"
property. 
---
My test shows there are 2 property change events with both names: "focusAcceleratorKey" and
"focusAccelerator".
It confirms all mentioned above, and I believe it was done for compatibility with prev versions.

And my view is: we could fire 2 events also.

The test is: [to be attached]

import java.beans.PropertyChangeListener;

import javax.swing.JTextArea;
import javax.swing.text.JTextComponent;

public class Text {
	public static void main(String[] args) {
		System.out.println(JTextComponent.FOCUS_ACCELERATOR_KEY);
		JTextArea area = new JTextArea();
		area.addPropertyChangeListener(new PropertyChangeListener() {
			public void propertyChange(java.beans.PropertyChangeEvent arg0) {
			     System.out.println("name = " + arg0.getPropertyName() + " " 
			    		 + arg0.getNewValue()
			    		 + " "
			    		 + arg0.getOldValue()
			    		 );	
			}
		});
		System.out.println("_________");
		area.setFocusAccelerator('7');
		System.out.println("_________");
		area.setFocusAccelerator('8');
		System.out.println("_________");
		area.setFocusAccelerator('9');
		System.out.println("_________");
		area.setFocusAccelerator('a');
		System.out.println("_________");
		area.setFocusAccelerator('b'); 	
		System.out.println("_________");
	}

}


RI output:

focusAcceleratorKey

_________

name = focusAcceleratorKey 7 _

name = _WhenInFocusedWindow {} null

name = focusAccelerator 7 _

_________

name = focusAcceleratorKey 8 7

name = _WhenInFocusedWindow null {}

name = _WhenInFocusedWindow {} null

name = focusAccelerator 8 7

_________

name = focusAcceleratorKey 9 8

name = _WhenInFocusedWindow null {}

name = _WhenInFocusedWindow {} null

name = focusAccelerator 9 8

_________

name = focusAcceleratorKey A 9

name = _WhenInFocusedWindow null {}

name = _WhenInFocusedWindow {} null

name = focusAccelerator A 9

_________

name = focusAcceleratorKey B A

name = _WhenInFocusedWindow null {}

name = _WhenInFocusedWindow {} null

name = focusAccelerator B A

_________

 










> [classlib][swing] javax.swing.text.JTextComponent focusAcceleratorKey property has invalid
name
> -----------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-2647
>                 URL: https://issues.apache.org/jira/browse/HARMONY-2647
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Anton Ivanov
>
> See http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4177283
> Since javax.swing.text.JTextComponent has methods getFocusAccelerator(), setFocusAccelerator(),
the corresponding property name should be "focusAccelerator".
> The test to reproduce the problem:
> ----------------------------------------------------------------------------------
> import java.beans.*;
> import javax.swing.text.*;
> import javax.swing.event.*;
> public class FocusAcceleratorKeyTest {
>     JTextComponent jtc;
>     SimplePropertyChangeListener pChListener;
>     class SimplePropertyChangeListener implements PropertyChangeListener {
>         PropertyChangeEvent event;
>         public void propertyChange(final PropertyChangeEvent e) {
>             if (e.getPropertyName() != "ancestor") {
>                 event = e;
>             }
>         }
>     }
>     public static void main(String argv[]) {
>         new FocusAcceleratorKeyTest().test();            
>     }
>     public void test() {
>        pChListener = new SimplePropertyChangeListener();
>        jtc = new JTextArea();
>        jtc.addPropertyChangeListener(pChListener);
>        jtc.setFocusAccelerator('b');
>        System.out.println(pChListener.event.getPropertyName());
>        System.out.println(JTextComponent.FOCUS_ACCELERATOR_KEY);
>     }
> }
> ----------------------------------------------------------------------------------
> RI returns the right name for the property: "focusAccelerator" while Harmony returns
"focusAcceleratorKey".
> Specification says that JTextComponent.FOCUS_ACCELERATOR_KEY is the "bound property name
for the focus accelerator"
> it is defined as "focusAcceleratorKey" in specification. It seems to be a misprint.
> JTextComponent.FOCUS_ACCELERATOR_KEY should be "focusAccelerator" and PropertyChangeEvent.getPropertyName
should return a right property name.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message