Hello All,

Please review the re-worked fix.
Bug: https://bugs.openjdk.java.net/browse/JDK-8075084
Webrev : http://cr.openjdk.java.net/~rchamyal/8075084/webrev.03/

In the updated fix a global awt event listener has been added to 
BasicScrollBarUI to take actions on mouse events.
The awt event listener determines the state of arrow buttons and source of 
mouse events and based on these it stops the timer.

Regards,
Rajeev Chamyal


 -----Original Message-----
From: Alexander Scherbatiy 
Sent: 13 January 2016 21:48
To: Rajeev Chamyal
Cc: Sergey Bylokhov; swing-dev@openjdk.java.net
Subject: Re: <Swing Dev> Review request for JDK-8075084 
JOptionPane.showMessageDialog causes JScrollBar to move

On 1/12/2016 5:28 PM, Rajeev Chamyal wrote:
> Hello All,
>
> Gentle reminder to review the fix.
> http://cr.openjdk.java.net/~rchamyal/8075084/webrev.02/

    My impression was that the scroll timer is started before an adjustment 
listener is executed. In this case the timer can track the open modal dialog 
and be stopped.
    It looks like the real situation is opposite and the scroll timer should 
track the closed modal dialog which is not reliable because it is possible to 
press and hold  a scroll thumb on another scrollbar and it will detect the 
closed modal dialog too.

    If I am correct for the first version of the fix the mouse release and exit 
events can be still missed if a modal dialog is shown outside the scroll bar.

    I do not have a good idea how the mouse exit event can be caught in this 
case when a modal dialog is shown.
    May be it possible to add a counter of mouse release events to the toolkit 
(or read it by AWTEventListener).
    If number of mouse release events are different before the scroll bar  
adjustment listener is executed and after that it means that mouse was released 
on a modal dialog or missed by some other reason.

   Thanks,
   Alexandr.

>
>
> Regards,
> Rajeev Chamyal
>
> -----Original Message-----
> From: Rajeev Chamyal
> Sent: 27 December 2015 20:32
> To: Sergey Bylokhov
> Cc: swing-dev@openjdk.java.net
> Subject: Re: <Swing Dev> Review request for JDK-8075084 
> JOptionPane.showMessageDialog causes JScrollBar to move
>
> Hello Sergey,
>
> The first webrev version is implemented on similar lines as you suggested but 
> it had issues as pointed my Alexandr in his review below.
> If the mouse pointer after clicking on modal dialog close lies outside the 
> parent window then parent window is not getting any mouse events and 
> BasicScrollBarUI::scrollByUnit method is again getting called recursively, 
> Because of which the scroll bar pointer keeps on moving till the end of 
> scrollbar.
> With this new implementation these issue are not seen.
>
> Regards,
> Rajeev Chamyal
>
>
> -----Original Message-----
> From: Sergey Bylokhov
> Sent: 25 December 2015 21:52
> To: Rajeev Chamyal; Alexander Scherbatiy
> Cc: Prasanta Sadhukhan; swing-dev@openjdk.java.net
> Subject: Re: Review request for JDK-8075084 
> JOptionPane.showMessageDialog causes JScrollBar to move
>
> Probably this bug can be fixed in a different way. Is it possible to check 
> the state of the scroll bar in the timer? And if in some iteration the button 
> became unpressed then stops itself(timer).
>
> On 23/12/15 12:29, Rajeev Chamyal wrote:
>> Hello Alexandr,
>>
>> The modal dialog can be application modal, document modal and toolkit modal.
>>        1) Application-modal dialog box blocks all windows from the same 
>> application, except windows from its child hierarchy
>>        2) Document-modal dialog box blocks all windows from the same 
>> document, except windows from its child hierarchy.
>>        3) Toolkit-modal dialog box blocks all windows that run in the 
>> same toolkit, except windows from its child hierarchy
>>
>> The current issue is reproducible with all modal dialog types. I have 
>> updated the condition in code to check for modal dialogs.
>>
>> http://cr.openjdk.java.net/~rchamyal/8075084/webrev.02/
>>
>> Regards,
>> Rajeev Chamyal
>>
>> -----Original Message-----
>> From: Alexander Scherbatiy
>> Sent: 22 December 2015 05:13
>> To: Rajeev Chamyal
>> Cc: Sergey Bylokhov; Prasanta Sadhukhan; swing-dev@openjdk.java.net
>> Subject: Re: Review request for JDK-8075084 
>> JOptionPane.showMessageDialog causes JScrollBar to move
>>
>> On 21/12/15 12:21, Rajeev Chamyal wrote:
>>> Hello Alexandr,
>>>
>>> I have updated the fix. Please review it.
>>> http://cr.openjdk.java.net/~rchamyal/8075084/webrev.01/
>>       When a modal dialog is shown does it block all windows or is it 
>> possible that a modal dialog blocks some windows and does not block others?
>>
>>     Thanks,
>>     Alexandr.
>>
>>> Regards,
>>> Rajeev Chamyal
>>>
>>> -----Original Message-----
>>> From: Alexander Scherbatiy
>>> Sent: 10 December 2015 16:59
>>> To: Rajeev Chamyal
>>> Cc: Sergey Bylokhov; Prasanta Sadhukhan; swing-dev@openjdk.java.net
>>> Subject: Re: Review request for JDK-8075084 
>>> JOptionPane.showMessageDialog causes JScrollBar to move
>>>
>>> On 12/3/2015 11:08 AM, Rajeev Chamyal wrote:
>>>> Hello Alexandr,
>>>>
>>>> Thanks for the review.
>>>>
>>>> When we open a JOption dialog from AdjustmentListener the scroll 
>>>> bar arrow button is not receiving the mouse release event.
>>>>
>>>> As a result the JScrollBar: scrollTimer is not getting stopped and 
>>>> its becoming a recursive call.
>>>>
>>>        I tried to run the BuggyDialog sample form the issue description 
>>> with the suggested fix.
>>>        I noticed a strange behavior when I press scroll down and click not 
>>> on the JOptionPane OK button but on the close button.
>>>        The scroll bar continues scrolling in this case.
>>>
>>>        When a modal dialog is open it blocks others windows. Is it possible 
>>> to check this event and stop the scroll timer in this case?
>>>
>>>       Thanks,
>>>       Alexandr.
>>>
>>>> Regards,
>>>>
>>>> Rajeev Chamyal
>>>>
>>>> *From:*Alexandr Scherbatiy
>>>> *Sent:* 02 December 2015 13:56
>>>> *To:* Rajeev Chamyal; Sergey Bylokhov; Prasanta Sadhukhan; 
>>>> swing-dev@openjdk.java.net
>>>> *Subject:* Re: Review request for JDK-8075084 
>>>> JOptionPane.showMessageDialog causes JScrollBar to move
>>>>
>>>> On 11/11/2015 7:47 AM, Rajeev Chamyal wrote:
>>>>
>>>>        Hello All,
>>>>
>>>>        Please review the following fix for Jdk9:
>>>>
>>>>
>>>>
>>>>        Bug:https://bugs.openjdk.java.net/browse/JDK-8075084
>>>>
>>>>        Webrev:http://cr.openjdk.java.net/~rchamyal/8075084/webrev.00/
>>>>        <http://cr.openjdk.java.net/%7Erchamyal/8075084/webrev.00/>
>>>>
>>>>        Issue: On running the sample program attached in bug JDK-8075084
>>>>        user is expected to see a scrollbar and on clicking the scrollbar
>>>>        tracker or scrollbar up/down arrow buttons a JOption dialog should
>>>>        come once. The program works fine if scrollbar tracker is clicked
>>>>        i.e. JOption dialog comes only once. But on clicking up/down arrow
>>>>        buttons of scrollbar the JOption dialog keeps on coming repeatedly.
>>>>
>>>>        Cause: The mouse pressed event of scrollbar arrow buttons calls 
>>>> BasicScrollBarUI::scrollByUnit method which creates a property change 
>>>> event and calls scroll bar action listener which again calls 
>>>> BasicScrollBarUI::scrollByUnit. This is becoming a recursive call and 
>>>> causing the scrollbar slider to move repeatedly till it reaches the other 
>>>> end of scrollbar.
>>>>
>>>>       If I change the AdjustmentListener to not show the 
>>>> JOptionPane it is called only one time.
>>>>       What is the reason that showing JOptionPane causes that the 
>>>> AdjustmentListener is called one more time?
>>>>
>>>>       Thanks,
>>>>       Alexandr.
>>>>
>>>>
>>>>
>>>>
>>>>        Fix: Added checks in the BasicScrollBarUI action listener to stop 
>>>> the recursion.
>>>>
>>>>
>>>>
>>>>        Regards,
>>>>
>>>>        Rajeev Chamyal
>>>>
>
> --
> Best regards, Sergey.

Reply via email to