[OpenJDK 2D-Dev] [9] RFR: JDK-8061258, , [macosx] PrinterJob's native Print Dialog does not reflect specified Copies or Page Ranges

Philip Race philip.race at oracle.com
Wed Mar 23 23:09:03 UTC 2016



On 3/23/16, 4:02 AM, prasanta sadhukhan wrote:
> Hi Phil,
>
> Please review a fix for jdk9
> Bug: https://bugs.openjdk.java.net/browse/JDK-8061258

Gosh, it appears I submitted that bug 18 months ago although
I don't remember how I came across the problem.

I need to understand the fix better and it doesn't help that I don't 
understand this line :-

  } else if (selectID == 3) {

SelectID is set from a single flag bit .. so it will never be 3,
at least not anywhere I can find. What case is that supposed to
be covering ?

-phil.


> webrev :http://cr.openjdk.java.net/~psadhukhan/8061258/webrev.00/
>
> When user attempts to pre-populate the native dialog with copies and 
> page ranges by calling
>  PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
>         aset.add(new Copies(2));
>         aset.add(new PageRanges(3,4));
> the print dialog does not reflect the user-defined setting.
>
> This is because osx native code was calling getNumberOfPages() from 
> OpenBook.java which was returning UNKNOWN_NUMBER_OF_PAGES (-1).
> Since getNumberOfPages() returned -1, osx always selected 
> NSPrintAllPages or All Radio button.
>
> I fixed it by removing this call to getNumberOfPages() and rely on 
> getMinPage/getMaxPage() as was done in windows 
> (awt_PrintControl.cpp:AwtPrintControl::InitPrintDialog) to select 
> which radio button to be selected.
> If fromPage > minPage or toPage < maxPage, it means user has selected 
> page ranges so PageRange radio button is to be selected else "All" 
> radio button to be selected.
>
> Regards
> Prasanta
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/2d-dev/attachments/20160323/b18c699a/attachment.html>


More information about the 2d-dev mailing list