} else { fidelity = false; } Attribute []attrs = reqAttrSet.toArray(); for (int i=0; i<attrs.length; i++) { attr = attrs[i]; category = attr.getCategory(); if (fidelity == true) { if (!service.isAttributeCategorySupported(category)) { notifyEvent(PrintJobEvent.JOB_FAILED); throw new PrintJobAttributeException( "unsupported category: " + category, category, null); } else if (!service.isAttributeValueSupported(attr, flavor, null)) { notifyEvent(PrintJobEvent.JOB_FAILED); throw new PrintJobAttributeException( "unsupported attribute: " + attr, null, attr); } } if (category == JobName.class) { jobName = ((JobName)attr).getValue(); } else if (category == Copies.class) { copies = ((Copies)attr).getValue(); } else if (category == Media.class) { if (attr instanceof MediaSizeName && service.isAttributeValueSupported(attr, null, null)) { mediaSize = MediaSize.getMediaSizeForName((MediaSizeName)attr); } } else if (category == OrientationRequested.class) { orient = (OrientationRequested)attr; } } } /* Cancel PrinterJob jobs that haven't yet completed. */ public void cancel() throws PrintException { synchronized (this) { if (!printing) { throw new PrintException("Job is not yet submitted."); } else if (job != null && !printReturned) { job.cancel(); notifyEvent(PrintJobEvent.JOB_CANCELED); return; } else { throw new PrintException("Job could not be cancelled."); } } } }Lines 501–552 of 552. Previous lines
} else { fidelity = false; } Attribute []attrs = reqAttrSet.toArray(); for (int i=0; i<attrs.length; i++) { attr = attrs[i]; category = attr.getCategory(); if (fidelity == true) { if (!service.isAttributeCategorySupported(category)) { notifyEvent(PrintJobEvent.JOB_FAILED); throw new PrintJobAttributeException( "unsupported category: " + category, category, null); } else if (!service.isAttributeValueSupported(attr, flavor, null)) { notifyEvent(PrintJobEvent.JOB_FAILED); throw new PrintJobAttributeException( "unsupported attribute: " + attr, null, attr); } } if (category == JobName.class) { jobName = ((JobName)attr).getValue(); } else if (category == Copies.class) { copies = ((Copies)attr).getValue(); } else if (category == Media.class) { if (attr instanceof MediaSizeName && service.isAttributeValueSupported(attr, null, null)) { mediaSize = MediaSize.getMediaSizeForName((MediaSizeName)attr); } } else if (category == OrientationRequested.class) { orient = (OrientationRequested)attr; } } } /* Cancel PrinterJob jobs that haven't yet completed. */ public void cancel() throws PrintException { synchronized (this) { if (!printing) { throw new PrintException("Job is not yet submitted."); } else if (job != null && !printReturned) { job.cancel(); notifyEvent(PrintJobEvent.JOB_CANCELED); return; } else { throw new PrintException("Job could not be cancelled."); } } } }