<Swing Dev> <AWT Dev> Webrev available for rfe 6929295 Generic support of mouse event transformation for AWT/Swing

Piet Blok pbhome at ziggo.nl
Thu Apr 15 11:48:24 UTC 2010


Hi Anthony,


> Hi Piet,
>
> I've reviewed the AWT part of the fix only. Some comments follow.
>
> src/share/classes/java/awt/Container.java
>> 2356      * @throws IllegalComponentStateException when inverse 
>> transformation is not possible
>
> I believe IllegalArgumentException works best in that case since whether 
> or not it is thrown depends on the x, y arguments (and the state - the 
> transform - of course, but that's not the primary reason for the method to 
> fail).
>

Answered by Alexander.

>
> src/share/classes/java/awt/Component.java
>> 2045                 if (peer instanceof LightweightPeer) {
>> 2089                 if (peer instanceof LightweightPeer) {
>
> I suggest using the isLightweight() method instead.

I followed the exact structure as found in the existing method 
getLocationOnScreen_NoTreeLock(). I regarded that existing code more or less 
as "sacred" and to be followed.

>
>
>> 2081      *          or if an invocation of {@link 
>> Container#toLayoutSpace(int, int)} throws
>> 2082      *          this Exception.
>
> My comment above regarding the ICSE applies to this note as well.
>
>
>> 2089                 if (peer instanceof LightweightPeer) {
>> 2090                     Container host = getNativeContainer();
>> 2091                     if (this == host) {
>
> How could that happen? The peer is lightweight and the component is a 
> *native* host?

Ahh... Good point: getLayoutLocation differs from getRenderedLocation in 
that getLayoutLocation() uses recursive calling (the calculation must start 
at the top level container). I didn't notice that reverting to the ordinary 
getLocationOnScreen() will be triggered by (peer instanceof LightweightPeer) 
already. So yes, the method can be made more straight forward.

I changed the code and the webrev has been refreshed.

Thanks for reviewing.
Piet

>
> --
> best regards,
> Anthony
>
> On 4/14/2010 8:13 PM Piet Blok wrote:
>> Hi all,
>>
>> A webrev is available for rfe 6929295 Generic support of mouse event 
>> transformation for AWT/Swing.
>> http://www.pbjar.org/OpenJDK/6929295/webrev/
>>
>> To better understand the concept, I created a document "How to use 
>> transformations in Swing"
>> http://www.pbjar.org/JLayer/doc/HowToUseTransform.html
>>
>> Please review,
>>
>> Thanks
>> Piet
>>
> 





More information about the swing-dev mailing list