<Swing Dev> [9] Review request for 8152677 [macosx] All files filter can't be selected in JFileChooser

Sergey Bylokhov Sergey.Bylokhov at oracle.com
Tue Apr 19 13:04:25 UTC 2016


Looks fine.

On 19.04.16 15:21, Alexander Scherbatiy wrote:
>
>    Hello,
>
>    Could you review the updated fix:
>      http://cr.openjdk.java.net/~alexsch/8152677/webrev.01
>
>    - file chooser file filter is used as an initial value for the old
> file filter in the AquaFileChooserUI.FilterComboBoxModel
>    - AcceptAllFileFilter class and filed are made static
>
>
>   The current regression appears after fixing issue JDK-8031696 [macosx]
> TwentyThousandTest test failed with OOM.
>   This was because for the each file filter setting (this includes file
> chooser creating and UI updating) new Aqua L&F file loading thread was
> started.
>   The current fix makes the acceptAllFileFilter field static which
> allows to eliminate the tread starting when the file chooser UI is
> updated. However, it is still not enough and the TwentyThousandTest
> still fails. It requires additional investigation what else leads to the
> OOME.  I have created a separate issue on it: JDK-8154548 [macosx]
> Reconsider TwentyThousandTest test failed fix:
>     https://bugs.openjdk.java.net/browse/JDK-8154548
>
>    Thanks,
>    Alexandr.
>
>
> On 15/04/16 20:26, Sergey Bylokhov wrote:
>> On 15.04.16 19:22, Alexander Scherbatiy wrote:
>>> On 15/04/16 18:27, Sergey Bylokhov wrote:
>>>   When a JFileChooser is created it always adds Accept All file filter
>>> in the constructor because useAcceptAllFileFilter filed is true by
>>> default.
>>>   Because of this the AquaFileChooserUI.FilterComboBoxModel initially
>>> has the Accept All file filter as the first item.
>>>
>>>   After that it is possible to unset the Accept All file filter by
>>> calling JFileChooser.setAcceptAllFileFilterUsed(false).
>>
>> But what will happen if the user will update the filter before the
>> Aqua will be set as default l&f(for example if Metal is set as default
>> via commandline)?
>>
>>>> On 15.04.16 16:46, Alexander Scherbatiy wrote:
>>>>>
>>>>> Hello,
>>>>>
>>>>> Could you review the fix:
>>>>>    bug: https://bugs.openjdk.java.net/browse/JDK-8152677
>>>>>    webrev: http://cr.openjdk.java.net/~alexsch/8152677/webrev.00
>>>>>
>>>>>    FilterComboBoxModel from AquaFileChooserUI overrides
>>>>> getSelectedItem() method to always return the selected filter from the
>>>>> file chooser.
>>>>>
>>>>>    JFileChooser.setFileFilter(FileFilter) first assign the passed
>>>>> filter
>>>>> to fileFilter field and then fire "fileFilterChanged" property change
>>>>> event. This leads that FilterComboBoxModel compares new file filter
>>>>> with
>>>>> the selected one (which has the same value because it is obtained from
>>>>> JFileChooser.fileFilter field) and do not updated JComboBox internal
>>>>> structure so JComboBox.selectedItemReminder field still points to the
>>>>> old one.
>>>>>
>>>>>    When a user selects “All Files” filter which is the first item
>>>>> from a
>>>>> JFileChooser the JComboBox does not fire the action event because
>>>>> selectedItemReminder points to the same first item.
>>>>>
>>>>>    The proposed solution is to remember the previous selected item in
>>>>> the AquaFileChooserUI.FilterComboBoxModel.
>>>>>
>>>>>    Thanks,
>>>>>    Alexandr.
>>>>
>>>>
>>>
>>
>>
>


-- 
Best regards, Sergey.



More information about the swing-dev mailing list