<Swing Dev> [10] RFR: JDK-8075918:The regression-swing case failed as the long Tab titles are not clipped with dots at the end with NimbusLookAndFeel
Sergey Bylokhov
sergey.bylokhov at oracle.com
Thu Jun 8 16:04:28 UTC 2017
I have referenced these methods:
"BasicTabbedPaneUI.paintIcon() as well as SynthGraphicsUtils.paintText() are called in SynthTabbedPaneUI.
- paintText() at line 681
- paintIcon() at line 634
Both methods have a rectangle as a parameter, but it is ignored."
The first is in the BasicTabbedPaneUI.java and the second is in the SynthGraphicsUtils.java
>
> Why? clip is invoked in SynthTabbedPaneUI#paintText() at line 687 and SynthTabbedPaneUI#paintTab() at line 637, where you asked for, I guess.
> Regards
> Prasanta
> On 6/8/2017 12:59 PM, Sergey Bylokhov wrote:
>> But in this version the clip operation still not executed in methods mentioned here:
>> http://mail.openjdk.java.net/pipermail/swing-dev/2017-June/007419.html <http://mail.openjdk.java.net/pipermail/swing-dev/2017-June/007419.html>
>> http://mail.openjdk.java.net/pipermail/swing-dev/2017-May/007406.html <http://mail.openjdk.java.net/pipermail/swing-dev/2017-May/007406.html>
>>
>>>
>>> Please find the modified webrev incorporating your review comment
>>>
>>> http://cr.openjdk.java.net/~psadhukhan/8075918/webrev.04/ <http://cr.openjdk.java.net/%7Epsadhukhan/8075918/webrev.04/>
>>>
>>> Regards
>>> Prasanta
>>> On 6/2/2017 12:33 AM, Sergey Bylokhov wrote:
>>>> - There is a problem in your algorithm which merges the old and new clips. The getClipBounds() returns a rectangle which is a bounds of the current clip(which is not necessary a rectangle but can be a shape). you can use the Graphics2D.clip(Shape) method which will intersect the passed shape and a current clip of the graphics.
>>>> - In this version you forgot to restore the changed clip.
>>>> - Also can you try to move the code which change a clip to the methods which currently ignore the passed clip(see below):
>>>>>>> BasicTabbedPaneUI.paintIcon() as well as
>>>>>>> SynthGraphicsUtils.paintText() are called in SynthTabbedPaneUI.
>>>>>>> - paintText() at line 681
>>>>>>> - paintIcon() at line 634
>>>>>>> Both methods have a rectangle as a parameter, but it is ignored.
>>>>
>>>> ----- prasanta.sadhukhan at oracle.com <mailto:prasanta.sadhukhan at oracle.com> wrote:
>>>>
>>>>> I tried to incorporate your comments. Please find modified webrev
>>>>>
>>>>> http://cr.openjdk.java.net/~psadhukhan/8075918/webrev.03/ <http://cr.openjdk.java.net/~psadhukhan/8075918/webrev.03/>
>>>>>
>>>>> Regards
>>>>> Prasanta
>>>>> On 5/28/2017 8:01 AM, Sergey Bylokhov wrote:
>>>>>> Note that you shouldn't replace the clip, but should apply the new
>>>>> clip on top of the old. This is necessary if the old clip is smaller
>>>>> than new.
>>>>>> ----- sergey.bylokhov at oracle.com <mailto:sergey.bylokhov at oracle.com> wrote:
>>>>>>
>>>>>>> Hi, Prasanta.
>>>>>>>
>>>>>>> BasicTabbedPaneUI.paintIcon() as well as
>>>>>>> SynthGraphicsUtils.paintText() are called in SynthTabbedPaneUI.
>>>>>>> - paintText() at line 681
>>>>>>> - paintIcon() at line 634
>>>>>>> Both methods have a rectangle as a parameter, but it is ignored.
>>>>>>>
>>>>>>> ----- prasanta.sadhukhan at oracle.com <mailto:prasanta.sadhukhan at oracle.com> wrote:
>>>>>>>
>>>>>>>> Hi Sergey,
>>>>>>>>
>>>>>>>> I could get your concern for paintText() but could not find
>>>>>>>> paintIcon()
>>>>>>>> in SynthGraphicsUtils() so not sure how icon drawing contradicts
>>>>>>>> spec.
>>>>>>>> Modified webrev:
>>>>>>>> http://cr.openjdk.java.net/~psadhukhan/8075918/webrev.01/ <http://cr.openjdk.java.net/~psadhukhan/8075918/webrev.01/>
>>>>>>>>
>>>>>>>> Also, if we are not calling
>>>>> SwingUtilities2.clipStringIfNecessary()
>>>>>>>> then
>>>>>>>> we are not going to get "..." at the end which this test expects.
>>>>>>> But
>>>>>>>> I
>>>>>>>> could not find anything in spec, that mandates ending with "..."
>>>>> for
>>>>>>>> long tab outside
>>>>>>>> tab bounds. If source change is ok, I guess we then need to
>>>>> modify
>>>>>>> the
>>>>>>>> html file modifying the expected result for NimbusL&F.
>>>>>>>>
>>>>>>>> Regards
>>>>>>>> Prasanta
>>>>>>>> On 5/25/2017 3:11 AM, Sergey Bylokhov wrote:
>>>>>>>>> Hi, Prasanta.
>>>>>>>>> Please take a look to my comments at:
>>>>>>>>>
>>>>> http://mail.openjdk.java.net/pipermail/swing-dev/2016-November/006931.html <http://mail.openjdk.java.net/pipermail/swing-dev/2016-November/006931.html>
>>>>> http://mail.openjdk.java.net/pipermail/swing-dev/2016-November/006902.html <http://mail.openjdk.java.net/pipermail/swing-dev/2016-November/006902.html>
>>>>>>>>> The two methods paintText() and paintIcon() are contradict the
>>>>>>> spec
>>>>>>>> and draw the text and icons outside of the tab.
>>>>>>>>> ----- prasanta.sadhukhan at oracle.com <mailto:prasanta.sadhukhan at oracle.com> wrote:
>>>>>>>>>
>>>>>>>>>> Hi All,
>>>>>>>>>>
>>>>>>>>>> Please review a fix for an issue where long Tab titiles are not
>>>>>>>>>> clipped
>>>>>>>>>> with dots at end for NimbusLookAndFeel L&F.
>>>>>>>>>> Other L&Fs works ok.
>>>>>>>>>>
>>>>>>>>>> Issue was in SynthTabbedPaneUI#paintTab(), the title is not
>>>>>>>> clipped
>>>>>>>>>> but
>>>>>>>>>> passed to paintText() as it is received.
>>>>>>>>>> Other L&F such as Metal, Motif, Windows which uses
>>>>>>>>>> BasicTabbedPaneUI#paintTab(), the title is clipped
>>>>>>>>>>
>>>>> http://hg.openjdk.java.net/jdk9/client/jdk/file/e748c6a2d2e6/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTabbedPaneUI.java#l950 <http://hg.openjdk.java.net/jdk9/client/jdk/file/e748c6a2d2e6/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTabbedPaneUI.java#l950>
>>>>>>>>>> before it is passed to paintText().
>>>>>>>>>>
>>>>>>>>>> Proposed fix is to do the same for
>>>>> SynthTabbedPaneUI#paintTab().
>>>>>>>>>> Bug: https://bugs.openjdk.java.net/browse/JDK-8075918 <https://bugs.openjdk.java.net/browse/JDK-8075918>
>>>>>>>>>> webrev:
>>>>>>> http://cr.openjdk.java.net/~psadhukhan/8075918/webrev.00/ <http://cr.openjdk.java.net/~psadhukhan/8075918/webrev.00/>
>>>>>>>>>> Regards
>>>>>>>>>> Prasanta
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/swing-dev/attachments/20170608/a2cc92de/attachment.html>
More information about the swing-dev
mailing list