<AWT Dev> <AWT dev>[9] Review request for 8154434: Open the request focus methods of the java.awt.Component which accept FocusEvent.Cause
Anton Tarasov
anton.tarasov at jetbrains.com
Thu Oct 20 13:17:07 UTC 2016
Hi all,
The changes look fine to me.
On 4/26/2016 3:49 PM, Philip Race wrote:
> > In applications one may need to know the reason why focus is requested
>
> I do not mean why should apps want to *know* the cause.
>
> I am asking why apps should be able to *specify* the cause as
> proposed by this change.
Currently an app, implementing a custom Component, may not even *know*
the cause why focus is requested to the Component. Opening the methods
lets the app override them at least.
At the moment I don't have a real request in mind for this API. But the
API indeed adds some more flexibility to focus management. For instance:
- An app can know from which direction focus has been traversed to a
custom component.
- An app can block focus request by mouse click preventing window
activation (and for example, postpone it).
Regards,
Anton.
>
> Being "symmetric" is not a sufficient reason.
>
> -phil.
>
> On 4/26/16, 12:27 AM, Semyon Sadetsky wrote:
>> On 4/25/2016 10:33 PM, Phil Race wrote:
>>> You will need to convince me of the appropriateness of opening these
>>> methods.
>>> It seems to me that are for the focus system, not for applications.
>>>
>>> Why should an application be allowed to say "I would like component
>>> X" to
>>> receive focus and tell it the reason is a mouse event" when in fact
>>> it is nothing of the kind.
>> This is a continuation of the 8080395. I think it would be mostly
>> interesting for framework developers not for applications.
>> In applications one may need to know the reason why focus is
>> requested to the component before the focus is set to it.
>> As I heard from Anton (that was his task initially) opening the cause
>> was requested by some client, but, unfortunately, I don't have any
>> references.
>>
>> --Semyon
>>>
>>> I would like to hear from others if they see a valid use case and
>>> that there are no
>>> down-sides to mis-use.
>>>
>>> -phil.
>>>
>>> On 04/19/2016 02:30 AM, Semyon Sadetsky wrote:
>>>> Hello,
>>>>
>>>> Please review fix for JDK9:
>>>>
>>>> bug: https://bugs.openjdk.java.net/browse/JDK-8154434
>>>> webrev: http://cr.openjdk.java.net/~ssadetsky/8154434/webrev.00/
>>>>
>>>> To support the new FocusEvent cause concept introduced by
>>>> JDK-8080395 the next package-private methods of the
>>>> java.awt.Component class are opened in the fix:
>>>>
>>>> boolean requestFocus(FocusEvent.Cause cause) -> public void
>>>> requestFocus(FocusEvent.Cause cause)
>>>>
>>>> boolean requestFocus(boolean temporary, FocusEvent.Cause cause) ->
>>>> protected boolean requestFocus(boolean temporary, FocusEvent.Cause
>>>> cause)
>>>>
>>>> boolean requestFocusInWindow(FocusEvent.Cause cause) -> public
>>>> boolean requestFocusInWindow(FocusEvent.Cause cause)
>>>>
>>>> The methods are changed to be symmetric with the focus request
>>>> methods of the same class which do not accept the cause parameter.
>>>> The method requestFocus(FocusEvent.Cause cause) was changed to
>>>> return no value similarly to the requestFocus() because the
>>>> returning boolean true cannot guarantee the focus gain.
>>>>
>>>> --Semyon
>>>>
>>>>
>>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/awt-dev/attachments/20161020/de0cb4d5/attachment-0001.html>
More information about the awt-dev
mailing list