<Swing Dev> [9] Review Request: 8048887 SortingFocusTraversalPolicy throws IllegalArgumentException from the sort method

Alexander Zvegintsev alexander.zvegintsev at oracle.com
Wed Jul 2 11:06:19 UTC 2014


Disregard my comment about GetBooleanAction, it does not have default value.

Thanks,

Alexander.

On 07/02/2014 02:53 PM, Alexander Zvegintsev wrote:
> Hi Anton,
>
> the fix looks good to me.
> BTW you can use GetBooleanAction instead of GetPropertyAction.
>
>
> Thanks,
>
> Alexander.
>
> On 07/01/2014 07:22 PM, Anton V. Tarasov wrote:
>> Hello,
>>
>> Please review a fix:
>>
>> bug: https://bugs.openjdk.java.net/browse/JDK-8048887
>> webrev: http://cr.openjdk.java.net/~ant/JDK-8048887/webrev.0
>>
>> The problem is that SortingFocusTraversalPolicy uses ROW_TOLERANCE 
>> conception to alter a disposition of components in a focus cycle for 
>> the sake of visually more appropriate traversal order. This however 
>> breaks the transitivity rule, which in case of using the default 
>> tim-sort algo leads to an exception.
>>
>> We've got a number of complaints filed against this issue, so I 
>> eventually agreed to use reflection as suggested in JDK-7075600.
>>
>> I've tested performance in the following way. In a jframe I was 
>> adding up to 10.000 components a) at random location (with frame's 
>> null Layout) so that to completely untie traversal order from 
>> container order (hard case for the sort), and b) sequentially, so 
>> that to have the traversal order pre-sorted. Then I counted time 
>> spent in the sorting procedure. The results of the legacy merge-sort 
>> and the default tim-sort were pretty close. So, the fallback to the 
>> legacy sorting algo shouldn't hit performance for Swing.
>>
>> Just for the case of any unpredictable issue (and for the testing 
>> purpose), I left an ability to switch to the default tim-sort via 
>> setting the (undocumented) "swing.legacySortingFTPEnabled" property 
>> to false.
>>
>> Regards,
>> Anton.
>




More information about the swing-dev mailing list