changeset 5189:5c703dacb076

7154047: [macosx] When we choose print one page in the print dialog,it still prints all the pages. Reviewed-by: anthony
author bae
date Wed, 28 Mar 2012 17:04:01 +0400
parents d55642417017
children 8a3c4f03855b
files src/macosx/classes/sun/lwawt/macosx/CPrinterJob.java
diffstat 1 files changed, 12 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/macosx/classes/sun/lwawt/macosx/CPrinterJob.java	Wed Mar 28 16:36:03 2012 +0400
+++ b/src/macosx/classes/sun/lwawt/macosx/CPrinterJob.java	Wed Mar 28 17:04:01 2012 +0400
@@ -33,6 +33,7 @@
 
 import javax.print.*;
 import javax.print.attribute.PrintRequestAttributeSet;
+import javax.print.attribute.standard.PageRanges;
 
 import sun.java2d.*;
 import sun.print.*;
@@ -145,6 +146,17 @@
     }
 
     protected void setAttributes(PrintRequestAttributeSet attributes) throws PrinterException {
+        if (attributes != null) {
+            PageRanges pageRangesAttr =
+                (PageRanges)attributes.get(PageRanges.class);
+            if (pageRangesAttr != null) {
+                SunPageSelection psel = (SunPageSelection)attributes.get(SunPageSelection.class);
+                if (psel == null) {
+                    attributes.add(SunPageSelection.RANGE);
+                }
+            }
+        }
+
         super.setAttributes(attributes);
 
         if (attributes == null) {