src/solaris/classes/sun/print/UnixPrintJob.java

Print this page




 293                 listenedAttributeSets.remove(index);
 294                 if (attrListeners.isEmpty()) {
 295                     attrListeners = null;
 296                     listenedAttributeSets = null;
 297                 }
 298             }
 299         }
 300     }
 301 
 302     public void print(Doc doc, PrintRequestAttributeSet attributes)
 303         throws PrintException {
 304 
 305         synchronized (this) {
 306             if (printing) {
 307                 throw new PrintException("already printing");
 308             } else {
 309                 printing = true;
 310             }
 311         }
 312 
 313         if ((PrinterIsAcceptingJobs)(service.getAttribute(
 314                          PrinterIsAcceptingJobs.class)) ==
 315                          PrinterIsAcceptingJobs.NOT_ACCEPTING_JOBS) {
 316             throw new PrintException("Printer is not accepting job.");
 317         }
 318 
 319         this.doc = doc;
 320         /* check if the parameters are valid before doing much processing */
 321         DocFlavor flavor = doc.getDocFlavor();
 322 
 323         Object data;
 324 
 325         try {
 326             data = doc.getPrintData();
 327         } catch (IOException e) {
 328             notifyEvent(PrintJobEvent.JOB_FAILED);
 329             throw new PrintException("can't get print data: " + e.toString());
 330         }
 331 
 332         if (flavor == null || (!service.isDocFlavorSupported(flavor))) {
 333             notifyEvent(PrintJobEvent.JOB_FAILED);
 334             throw new PrintJobFlavorException("invalid flavor", flavor);




 293                 listenedAttributeSets.remove(index);
 294                 if (attrListeners.isEmpty()) {
 295                     attrListeners = null;
 296                     listenedAttributeSets = null;
 297                 }
 298             }
 299         }
 300     }
 301 
 302     public void print(Doc doc, PrintRequestAttributeSet attributes)
 303         throws PrintException {
 304 
 305         synchronized (this) {
 306             if (printing) {
 307                 throw new PrintException("already printing");
 308             } else {
 309                 printing = true;
 310             }
 311         }
 312 
 313         if ((service.getAttribute(PrinterIsAcceptingJobs.class)) ==

 314                          PrinterIsAcceptingJobs.NOT_ACCEPTING_JOBS) {
 315             throw new PrintException("Printer is not accepting job.");
 316         }
 317 
 318         this.doc = doc;
 319         /* check if the parameters are valid before doing much processing */
 320         DocFlavor flavor = doc.getDocFlavor();
 321 
 322         Object data;
 323 
 324         try {
 325             data = doc.getPrintData();
 326         } catch (IOException e) {
 327             notifyEvent(PrintJobEvent.JOB_FAILED);
 328             throw new PrintException("can't get print data: " + e.toString());
 329         }
 330 
 331         if (flavor == null || (!service.isDocFlavorSupported(flavor))) {
 332             notifyEvent(PrintJobEvent.JOB_FAILED);
 333             throw new PrintJobFlavorException("invalid flavor", flavor);