< prev index next >

src/java.desktop/share/classes/sun/print/RasterPrinterJob.java

Print this page




 723           GraphicsEnvironment.getLocalGraphicsEnvironment().
 724           getDefaultScreenDevice().getDefaultConfiguration();
 725 
 726         PrintService service = java.security.AccessController.doPrivileged(
 727                                new java.security.PrivilegedAction<PrintService>() {
 728                 public PrintService run() {
 729                     PrintService service = getPrintService();
 730                     if (service == null) {
 731                         ServiceDialog.showNoPrintService(gc);
 732                         return null;
 733                     }
 734                     return service;
 735                 }
 736             });
 737 
 738         if (service == null) {
 739             return page;
 740         }
 741         updatePageAttributes(service, page);
 742 
 743         PageFormat newPage = pageDialog(attributes);












 744 
 745         if (newPage == null) {
 746             return page;
 747         } else {
 748             return newPage;
 749         }
 750     }
 751 
 752     /**
 753      * return a PageFormat corresponding to the updated attributes,
 754      * or null if the user cancelled the dialog.
 755      */
 756     @SuppressWarnings("deprecation")
 757     public PageFormat pageDialog(final PrintRequestAttributeSet attributes)
 758         throws HeadlessException {
 759         if (GraphicsEnvironment.isHeadless()) {
 760             throw new HeadlessException();
 761         }
 762 
 763         DialogTypeSelection dlg =




 723           GraphicsEnvironment.getLocalGraphicsEnvironment().
 724           getDefaultScreenDevice().getDefaultConfiguration();
 725 
 726         PrintService service = java.security.AccessController.doPrivileged(
 727                                new java.security.PrivilegedAction<PrintService>() {
 728                 public PrintService run() {
 729                     PrintService service = getPrintService();
 730                     if (service == null) {
 731                         ServiceDialog.showNoPrintService(gc);
 732                         return null;
 733                     }
 734                     return service;
 735                 }
 736             });
 737 
 738         if (service == null) {
 739             return page;
 740         }
 741         updatePageAttributes(service, page);
 742 
 743         PageFormat newPage = null;
 744         DialogTypeSelection dts =
 745             (DialogTypeSelection)attributes.get(DialogTypeSelection.class);
 746         if (dts == DialogTypeSelection.NATIVE) {
 747             // Remove DialogTypeSelection.NATIVE to prevent infinite loop in
 748             // RasterPrinterJob.
 749             attributes.remove(DialogTypeSelection.class);
 750             newPage = pageDialog(attributes);
 751             // restore attribute
 752             attributes.add(DialogTypeSelection.NATIVE);
 753         } else {
 754             newPage = pageDialog(attributes);
 755         }
 756 
 757         if (newPage == null) {
 758             return page;
 759         } else {
 760             return newPage;
 761         }
 762     }
 763 
 764     /**
 765      * return a PageFormat corresponding to the updated attributes,
 766      * or null if the user cancelled the dialog.
 767      */
 768     @SuppressWarnings("deprecation")
 769     public PageFormat pageDialog(final PrintRequestAttributeSet attributes)
 770         throws HeadlessException {
 771         if (GraphicsEnvironment.isHeadless()) {
 772             throw new HeadlessException();
 773         }
 774 
 775         DialogTypeSelection dlg =


< prev index next >