< prev index next >

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

Print this page




 984             });
 985 
 986             if ((services == null) || (services.length == 0)) {
 987                 /*
 988                  * No services but default PrintService exists?
 989                  * Create services using defaultService.
 990                  */
 991                 services = new PrintService[1];
 992                 services[0] = service;
 993             }
 994         }
 995 
 996         // we position the dialog a little beyond the upper-left corner of the window
 997         // which is consistent with the NATIVE print dialog
 998         int x = 50;
 999         int y = 50;
1000         PrintService newService;
1001         // temporarily add an attribute pointing back to this job.
1002         PrinterJobWrapper jobWrapper = new PrinterJobWrapper(this);
1003         attributes.add(jobWrapper);




1004         try {
1005             newService =
1006             ServiceUI.printDialog(gc, x, y,
1007                                   services, service,
1008                                   DocFlavor.SERVICE_FORMATTED.PAGEABLE,
1009                                   attributes);
1010         } catch (IllegalArgumentException iae) {
1011             newService = ServiceUI.printDialog(gc, x, y,
1012                                   services, services[0],
1013                                   DocFlavor.SERVICE_FORMATTED.PAGEABLE,
1014                                   attributes);
1015         }
1016         attributes.remove(PrinterJobWrapper.class);
1017 
1018         if (newService == null) {
1019             return false;
1020         }
1021 
1022         if (!service.equals(newService)) {
1023             try {




 984             });
 985 
 986             if ((services == null) || (services.length == 0)) {
 987                 /*
 988                  * No services but default PrintService exists?
 989                  * Create services using defaultService.
 990                  */
 991                 services = new PrintService[1];
 992                 services[0] = service;
 993             }
 994         }
 995 
 996         // we position the dialog a little beyond the upper-left corner of the window
 997         // which is consistent with the NATIVE print dialog
 998         int x = 50;
 999         int y = 50;
1000         PrintService newService;
1001         // temporarily add an attribute pointing back to this job.
1002         PrinterJobWrapper jobWrapper = new PrinterJobWrapper(this);
1003         attributes.add(jobWrapper);
1004         PageRanges pgRng = (PageRanges)attributes.get(PageRanges.class);
1005         if (pgRng == null && mDocument.getNumberOfPages() > 1) {
1006             attributes.add(new PageRanges(1, mDocument.getNumberOfPages()));
1007         }
1008         try {
1009             newService =
1010             ServiceUI.printDialog(gc, x, y,
1011                                   services, service,
1012                                   DocFlavor.SERVICE_FORMATTED.PAGEABLE,
1013                                   attributes);
1014         } catch (IllegalArgumentException iae) {
1015             newService = ServiceUI.printDialog(gc, x, y,
1016                                   services, services[0],
1017                                   DocFlavor.SERVICE_FORMATTED.PAGEABLE,
1018                                   attributes);
1019         }
1020         attributes.remove(PrinterJobWrapper.class);
1021 
1022         if (newService == null) {
1023             return false;
1024         }
1025 
1026         if (!service.equals(newService)) {
1027             try {


< prev index next >