<Swing Dev> [9] Review request for 8154431: Allow source and target based validation for the focus transfer between two JComponents.

Semyon Sadetsky semyon.sadetsky at oracle.com
Tue Apr 19 18:05:11 UTC 2016


On 4/19/2016 7:47 PM, Phil Race wrote:
> Hi,
>
> You are deprecating shouldYieldFocus(JComponent) and yet this class 
> directly uses it.
> Is this deprecation really the right thing to do ?
Why is this not correct? There are plenty examples in JDK: 
Component#setVisible() & Component#show(), Component#transferFocus() & 
Component#nextFocus(), etc...
This is necessary for backward compatibility.
>
> The new over-loaded shouldYieldFocus() is perhaps not much more than a 
> utility.
> And the doc says "calls verify(input)" which seems odd since you do not
> directly call it. And you are just describing what the default 
> implementation
> does aren't you ?
This is also necessary for compatibility. There may be implementations 
of the InputVerify where the shouldYieldFocus() is overloaded since it 
is public (that was initial design mistake, I suppose). At the same time 
the shouldYieldFocus() is the entry point that plugs InputVerify into 
the JComponent.
But you are correct "calls verify(input)" is not precisely describes 
what happens in this method. Maybe just make it more indirect, like 
"validate the source and the target components..."?

--Semyon
>
> -phil.
>
> On 04/19/2016 04:40 AM, Semyon Sadetsky wrote:
>> Hello,
>>
>> Please review fix for JDK9:
>> bug: https://bugs.openjdk.java.net/browse/JDK-8154431
>> webrev: http://cr.openjdk.java.net/~ssadetsky/8154431/webrev.00/
>>
>> The thing is the Swing validation doesn't allow to validate state of 
>> the target component of input focus transfer operation.
>> To support that the fix adds two new methods verifyTarget(JComponent 
>> target) and shouldYieldFocus(JComponent source, JComponent target) to 
>> the javax.swing.InputVerifier class, and its old 
>> shouldYieldFocus(JComponent input) is marked as deprecated.
>> The solution guaranties full compatibility with previous JDK versions.
>>
>> --Semyon
>>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/swing-dev/attachments/20160419/a2c61647/attachment.html>


More information about the swing-dev mailing list