Hi Phil,

Please review a fix for jdk9
Bug: https://bugs.openjdk.java.net/browse/JDK-8061258
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

Reply via email to