<Swing Dev> [9] RFR: JDK-8170349: The printed content is beyond the borders.

Prasanta Sadhukhan prasanta.sadhukhan at oracle.com
Thu Dec 22 11:35:22 UTC 2016


Modified webrev to use null instead of "" to clear the property.

Also, removed the casting and just use Object.

http://cr.openjdk.java.net/~psadhukhan/8170349/webrev.03/

Regards
Prasanta
On 12/22/2016 1:18 PM, Prasanta Sadhukhan wrote:
>
> Used put/getClientProperty instead of UIManager.put/get.
>
> Please find modified webrev:
>
> http://cr.openjdk.java.net/~psadhukhan/8170349/webrev.02/
>
> Regards
> Prasanta
> On 12/21/2016 5:06 PM, Prasanta Sadhukhan wrote:
>>
>> Hi Alex,
>>
>> Further to our discussion where you suggested not to modify table 
>> setBounds (even though it was for momentarily) and
>>  use property to convey printMode FIT_WIDTH to BasicTableUI, I did 
>> just the same.
>> Please find the modified webrev:
>> http://cr.openjdk.java.net/~psadhukhan/8170349/webrev.01/
>>
>> Regards
>> Prasanta
>> On 12/9/2016 5:57 PM, Prasanta Sadhukhan wrote:
>>>
>>>
>>>
>>> On 12/9/2016 8:18 PM, Alexandr Scherbatiy wrote:
>>>> On 12/6/2016 5:52 PM, Prasanta Sadhukhan wrote:
>>>>> On 12/6/2016 8:17 PM, Alexandr Scherbatiy wrote:
>>>>>> On 12/1/2016 9:16 AM, Prasanta Sadhukhan wrote:
>>>>>>> On 11/30/2016 2:53 PM, Prasanta Sadhukhan wrote:
>>>>>>>>
>>>>>>>> Hi All,
>>>>>>>>
>>>>>>>> Bug: https://bugs.openjdk.java.net/browse/JDK-8170349
>>>>>>>>
>>>>>>>> webrev: http://cr.openjdk.java.net/~psadhukhan/8170349/webrev.00/
>>>>>>>>
>>>>>>>> Please review a fix for a continuation/regression of 
>>>>>>>> JDK-8081491 <https://bugs.openjdk.java.net/browse/JDK-8081491> 
>>>>>>>> in which we made sure that we print only the JTable 
>>>>>>>> rows/columns that is visible on console.
>>>>>>>>
>>>>>>>> This bug manifests itself as, despite marking JTable PrintMode 
>>>>>>>> to FIT_WIDTH, we are printing only those columns that are 
>>>>>>>> visible on console.
>>>>>>>>
>>>>>>>> However, if JTable PrintMode is FIT_WIDTH, then as per spec
>>>>>>>> https://docs.oracle.com/javase/8/docs/api/javax/swing/JTable.PrintMode.html#FIT_WIDTH
>>>>>>>> we should print all columns on each page (apparently 
>>>>>>>> irrespective of what is visible)
>>>>>>>>
>>>>>>>> The fix takes care of that by making sure the table bounds is 
>>>>>>>> adjusted to clipwidth [which is already adjusted to total 
>>>>>>>> column width here 
>>>>>>>> <http://hg.openjdk.java.net/jdk9/client/jdk/file/f7148ccb86bb/src/java.desktop/share/classes/javax/swing/TablePrintable.java#l504>]
>>>>>>>> so that all columns are printed and also rectangle border is 
>>>>>>>> drawn encompassing all columns.
>>>>>>>>
>>>>>>> The reason of adjusting the table bounds was because 
>>>>>>> table.print() calls BasicTableUI.paint() where we compute 
>>>>>>> visibleBounds
>>>>>>> http://hg.openjdk.java.net/jdk9/client/jdk/file/a5e270f2c97d/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTableUI.java#l1817
>>>>>>> therefore we need to adjust the visibleBounds to entire columns 
>>>>>>> instead of just the visible columns.
>>>>>>   Did the test 
>>>>>> Swing_JTable/Manual/PrintManualTest_FitWidthMultiple pass before 
>>>>>> the fix for the JDK-8081491?
>>>>     Which logic in the fix JDK-8081491 causes that the printing a 
>>>> table with FIT_WIDTH mode stopped to properly work?
>>> We calculate visibleBounds in BasicTableUI for 8081491 so even for 
>>> FIT_WIDTH, it was printing the visible portion of table. Since, in 
>>> BasicTableUI we cannot access TablePrintable.PrintMode value(since 
>>> it is private), we need to make sure the table bounds set to full 
>>> column width so that visibleBounds calculated in BasicTableUI is 
>>> tricked to believe, that we are printing whole columns.
>>>
>>> Regards
>>> Prasanta
>>>>
>>>>   Thanks,
>>>>   Alexandr.
>>>>> Yes, it did.
>>>>>
>>>>> Regards
>>>>> Prasanta
>>>>>>   It looks like the table bounds never have been changed in the 
>>>>>> TablePrintable.
>>>>>>
>>>>>>   Thanks,
>>>>>>   Alexandr.
>>>>>>>
>>>>>>> Regards
>>>>>>> Prasanta
>>>>>>>> The 8081491 testcases passed with this fix as well.
>>>>>>>>
>>>>>>>> Regards
>>>>>>>> Prasanta
>>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>
>

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


More information about the swing-dev mailing list