<Swing Dev> Fwd: The file list in JFileChooser does not have an accessible name.

Pavel Porvatov pavel.porvatov at oracle.com
Thu Sep 1 12:37:17 UTC 2011


Hi Charles,
> On 08/25/2011 05:45 PM, Pavel Porvatov wrote:
>> Hi Charles,
>>> On 07/26/2011 08:58 PM, Charles Lee wrote:
>>>> On 07/06/2011 11:26 PM, Pavel Porvatov wrote:
>>>>> Hi Charles,
>>>>>> On 04/13/2011 06:41 PM, Pavel Porvatov wrote:
>>>>>>> Hi Charles,
>>>>>>>> On 03/30/2011 06:19 PM, Pavel Porvatov wrote:
>>>>>>>>> Hi Charles,
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> -------- Original Message --------
>>>>>>>>>> Subject: 	The file list in JFileChooser does not have an 
>>>>>>>>>> accessible name.
>>>>>>>>>> Date: 	Thu, 24 Mar 2011 17:23:25 +0800
>>>>>>>>>> From: 	Charles Lee <littlee at linux.vnet.ibm.com> 
>>>>>>>>>> <mailto:littlee at linux.vnet.ibm.com>
>>>>>>>>>> To: 	swing-dev at openjdk.java.net 
>>>>>>>>>> <mailto:swing-dev at openjdk.java.net>, 
>>>>>>>>>> littlee at linux.vnet.ibm.com <mailto:littlee at linux.vnet.ibm.com>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Hi guys,
>>>>>>>>>>
>>>>>>>>>> Start the SwingSet2.jar along with a accessibility tools (Scout), click
>>>>>>>>>> the JFileChooser and Show Plain JFileChooser, we will see an open
>>>>>>>>>> windows with file list inside. The file list does not have Name and
>>>>>>>>>> Description [1]. With a patch [2] attached, the name and description
>>>>>>>>>> will show as File List [3].
>>>>>>>>>>
>>>>>>>>>> [1] NoDescriptionName.png (attached)
>>>>>>>>>> [2] patch (attached)
>>>>>>>>>> [3] WithDescriptionName.png (attached)
>>>>>>>>>>
>>>>>>>>> I filed bug 7032018 (The file list in JFileChooser does not 
>>>>>>>>> have an accessible name). It's not accessible on bugs.sun.com 
>>>>>>>>> now, I believe because of "Some bugs don't show up in the 
>>>>>>>>> database for some time because of delays in processing."
>>>>>>>>>
>>>>>>>>> Thanks, Pavel
>>>>>>>>>
>>>>>>>> Hi Pavel,
>>>>>>>>
>>>>>>>> Does the change make into the code? Can I have the changeset of it?
>>>>>>> Nobody is working on this CR now, it just ACCEPTED... You can 
>>>>>>> trace status of the bug here:
>>>>>>> http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7032018
>>>>>>>
>>>>>>> Regards, Pavel
>>>>>> Hello Pavel, it's me, again :-)
>>>>>>
>>>>>> Is there any progress on this CR? Is ok if I move this issue to 
>>>>>> openjdk8?
>>>>> No progress. The issue is targeted to jdk8 already...
>>>>>
>>>>> Regards, Pavel
>>>> Hi guys,
>>>>
>>>> I have tested this issue on the openjdk8. It still there (Please 
>>>> check the first mail this thread: NoDescriptionName.png)
>>>> And with the patch (attached, rebase on the jdk8),
>>>> The problem gone away.
>>>>
>>>> Would anyone interested in this issue this time?
>>>>
>>>> -- 
>>>> Yours Charles
>>> Hi guys,
>>>
>>> Could some one take some to look at this patch?
>> I took a look at the patch and have several comments:
>>
>> 1. There is no AccessibleDescription for all resources, therefore I'd 
>> prefer to remove filesAccessibleDescription
>>
>> 2.  Please follow our code conventions 
>> http://www.oracle.com/technetwork/java/codeconvtoc-136057.html
>> a.
>> private String filesListAccessibleName=null;
>> =>
>> private String filesListAccessibleName = null;
>> b. Don't use TABs characters at all
>> c.
>> filesListAccessibleName 
>> =UIManager.getString("FileChooser.filesListAccessibleName",l);
>> =>
>> filesListAccessibleName = 
>> UIManager.getString("FileChooser.filesListAccessibleName", l);
>>
>> etc.
>>
>> 3. As in the last CR fixing you should add the same resources to all 
>> basic_XX.properties files
>>
>> 4. Why don't you use 
>> putClientProperty(AccessibleContext.ACCESSIBLE_NAME_PROPERTY, 
>> accessibleName) instead of "javax.accessibility.AccessibleContext 
>> ac=list.getAccessibleContext();......"
>>
>> Regards, Pavel
> putClientProperty still does not work on my side. I can not find 
> methods which receive the accessible property changes. Is the diff 
> attached you supposed to be?
Take a look at javax.swing.JComponent.AccessibleJComponent#getAccessibleName

...
             if (name == null) {
                 name = 
(String)getClientProperty(AccessibleContext.ACCESSIBLE_NAME_PROPERTY);
             }
...


Below is FilePane patch that works on my PC:

# hg diff src/share/classes/sun/swing/FilePane.java
diff --git a/src/share/classes/sun/swing/FilePane.java 
b/src/share/classes/sun/swing/FilePane.java
--- a/src/share/classes/sun/swing/FilePane.java
+++ b/src/share/classes/sun/swing/FilePane.java
@@ -35,6 +35,7 @@
  import java.util.List;
  import java.util.concurrent.Callable;

+import javax.accessibility.AccessibleContext;
  import javax.swing.*;
  import javax.swing.border.*;
  import javax.swing.event.*;
@@ -82,6 +83,8 @@
      private JPanel currentViewPanel;
      private String[] viewTypeActionNames;

+    private String filesListAccessibleName = null;
+
      private JPopupMenu contextMenu;
      private JMenu viewMenu;

@@ -450,6 +453,8 @@
          gigaByteString = 
UIManager.getString("FileChooser.fileSizeGigaBytes", l);
          fullRowSelection = 
UIManager.getBoolean("FileView.fullRowSelection");

+        filesListAccessibleName = 
UIManager.getString("FileChooser.filesListAccessibleName",l);
+
          renameErrorTitleText = 
UIManager.getString("FileChooser.renameErrorTitleText", l);
          renameErrorText = 
UIManager.getString("FileChooser.renameErrorText", l);
          renameErrorFileExistsText = 
UIManager.getString("FileChooser.renameErrorFileExistsText", l);
@@ -634,6 +639,9 @@
          if (listViewBorder != null) {
              scrollpane.setBorder(listViewBorder);
          }
+
+        
list.putClientProperty(AccessibleContext.ACCESSIBLE_NAME_PROPERTY, 
filesListAccessibleName);
+
          p.add(scrollpane, BorderLayout.CENTER);
          return p;
      }

I used attached test for checking...

Regards, Pavel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/swing-dev/attachments/20110901/5d66d982/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Test.java
Type: text/java
Size: 1281 bytes
Desc: not available
URL: <http://mail.openjdk.java.net/pipermail/swing-dev/attachments/20110901/5d66d982/Test.java>


More information about the swing-dev mailing list