[OpenJDK 2D-Dev]  RFR: JDK-6529030, , Java Printing: Print range > Selection gets enabled
prasanta.sadhukhan at oracle.com
Wed Apr 6 10:09:51 UTC 2016
Please review a fix for jdk9.
The issue was when using java.awt.print.PrinterJob instance more then
once, Selection radio button in Print dialog gets enabled from 2nd
instance even though we are printing "All" pages
however Selection radio button is disabled in the first instance.
This is seen in windows.
This is because initially when windows initialized the print dialog, it
calls InitPrintDialog() which calls getSelectAttrib() to find out which
selection attribute user has selected.
getSelectAttrib() returns PD_NOSELECTION as SunPageSelection.class was
not added to attribute.
So, in InitPrintDialog() we set PRINTDLG flags to PD_NOSELECTION. So, we
see "Selection " radio button is disabled in 1st instance of print dialog.
Now, when user presses "OK", windows native code calls
setNativeAttributes() and adds SunPageSelection.class to the attribute
with SunPageSelection.ALL or SunPageSelection.RANGE.
When 2nd print dialog is shown, InitPrintDialog() will again call
getSelectAttrib() which will now return
SunPageSelection.ALL/SunPageSelection.RANGE which will be set to
PRINTDLG flag but
we are not disabling Selection radio button, so in 2nd instance,
Selection radio button gets enabled.
Fix was to check if PD_SELECTION attribute is selected by user, if not ,
sets PRINTDLG flag with PD_NOSELECTION.
I have checked 8151590 and 8061267 works correctly with this patch.
More information about the 2d-dev