Java 类javax.print.event.PrintJobEvent 实例源码

项目:javify    文件:DocPrintJobImpl.java   
private void notifyPrintJobListeners(PrintJobEvent e)
{
  Iterator it = printJobListener.iterator();
  while (it.hasNext())
    {
      PrintJobListener l = (PrintJobListener) it.next();
      if (e.getPrintEventType() == PrintJobEvent.DATA_TRANSFER_COMPLETE)
        l.printDataTransferCompleted(e);
      else if (e.getPrintEventType() == PrintJobEvent.JOB_CANCELED)
        l.printJobCanceled(e);
      else if (e.getPrintEventType() == PrintJobEvent.JOB_COMPLETE)
        l.printJobCompleted(e);
      else if (e.getPrintEventType() == PrintJobEvent.JOB_FAILED)
        l.printJobFailed(e);
      else if (e.getPrintEventType() == PrintJobEvent.NO_MORE_EVENTS)
        l.printJobNoMoreEvents(e);
      else
        l.printJobRequiresAttention(e);
    }
}
项目:OpenJSharp    文件:PSStreamPrintJob.java   
public void pageableJob(Pageable pageable,
                        PrintRequestAttributeSet attributes)
    throws PrintException {
    try {
        synchronized(this) {
            if (job != null) { // shouldn't happen
                throw new PrintException("already printing");
            } else {
                job = new PSPrinterJob();
            }
        }
        job.setPrintService(getPrintService());
        job.setPageable(pageable);
        job.print(attributes);
        notifyEvent(PrintJobEvent.JOB_COMPLETE);
        return;
    } catch (PrinterException pe) {
        notifyEvent(PrintJobEvent.JOB_FAILED);
        throw new PrintException(pe);
    } finally {
        printReturned = true;
    }
}
项目:OpenJSharp    文件:UnixPrintJob.java   
public void pageableJob(Pageable pageable) throws PrintException {
    try {
        synchronized(this) {
            if (job != null) { // shouldn't happen
                throw new PrintException("already printing");
            } else {
                job = new PSPrinterJob();
            }
        }
        job.setPrintService(getPrintService());
        job.setCopies(copies);
        job.setJobName(jobName);
        job.setPageable(pageable);
        job.print(reqAttrSet);
        notifyEvent(PrintJobEvent.DATA_TRANSFER_COMPLETE);
        return;
    } catch (PrinterException pe) {
        notifyEvent(PrintJobEvent.JOB_FAILED);
        throw new PrintException(pe);
    } finally {
        printReturned = true;
        notifyEvent(PrintJobEvent.NO_MORE_EVENTS);
    }
}
项目:OpenJSharp    文件:UnixPrintJob.java   
public Object run() {
    try {
        if (mDestType == UnixPrintJob.DESTFILE) {
            spoolFile = new File(mDestination);
        } else {
            /* Write to a temporary file which will be spooled to
             * the printer then deleted. In the case that the file
             * is not removed for some reason, request that it is
             * removed when the VM exits.
             */
            spoolFile = Files.createTempFile("javaprint", "").toFile();
            spoolFile.deleteOnExit();
        }
        result = new FileOutputStream(spoolFile);
        return result;
    } catch (IOException ex) {
        // If there is an IOError we subvert it to a PrinterException.
        notifyEvent(PrintJobEvent.JOB_FAILED);
        pex = new PrintException(ex);
    }
    return null;
}
项目:jdk8u-jdk    文件:PSStreamPrintJob.java   
public void pageableJob(Pageable pageable,
                        PrintRequestAttributeSet attributes)
    throws PrintException {
    try {
        synchronized(this) {
            if (job != null) { // shouldn't happen
                throw new PrintException("already printing");
            } else {
                job = new PSPrinterJob();
            }
        }
        job.setPrintService(getPrintService());
        job.setPageable(pageable);
        job.print(attributes);
        notifyEvent(PrintJobEvent.JOB_COMPLETE);
        return;
    } catch (PrinterException pe) {
        notifyEvent(PrintJobEvent.JOB_FAILED);
        throw new PrintException(pe);
    } finally {
        printReturned = true;
    }
}
项目:jdk8u-jdk    文件:UnixPrintJob.java   
public void pageableJob(Pageable pageable) throws PrintException {
    try {
        synchronized(this) {
            if (job != null) { // shouldn't happen
                throw new PrintException("already printing");
            } else {
                job = new PSPrinterJob();
            }
        }
        job.setPrintService(getPrintService());
        job.setCopies(copies);
        job.setJobName(jobName);
        job.setPageable(pageable);
        job.print(reqAttrSet);
        notifyEvent(PrintJobEvent.DATA_TRANSFER_COMPLETE);
        return;
    } catch (PrinterException pe) {
        notifyEvent(PrintJobEvent.JOB_FAILED);
        throw new PrintException(pe);
    } finally {
        printReturned = true;
        notifyEvent(PrintJobEvent.NO_MORE_EVENTS);
    }
}
项目:jdk8u-jdk    文件:UnixPrintJob.java   
public Object run() {
    try {
        if (mDestType == UnixPrintJob.DESTFILE) {
            spoolFile = new File(mDestination);
        } else {
            /* Write to a temporary file which will be spooled to
             * the printer then deleted. In the case that the file
             * is not removed for some reason, request that it is
             * removed when the VM exits.
             */
            spoolFile = Files.createTempFile("javaprint", "").toFile();
            spoolFile.deleteOnExit();
        }
        result = new FileOutputStream(spoolFile);
        return result;
    } catch (IOException ex) {
        // If there is an IOError we subvert it to a PrinterException.
        notifyEvent(PrintJobEvent.JOB_FAILED);
        pex = new PrintException(ex);
    }
    return null;
}
项目:openjdk-jdk10    文件:PSStreamPrintJob.java   
public void pageableJob(Pageable pageable,
                        PrintRequestAttributeSet attributes)
    throws PrintException {
    try {
        synchronized(this) {
            if (job != null) { // shouldn't happen
                throw new PrintException("already printing");
            } else {
                job = new PSPrinterJob();
            }
        }
        job.setPrintService(getPrintService());
        job.setPageable(pageable);
        job.print(attributes);
        notifyEvent(PrintJobEvent.JOB_COMPLETE);
        return;
    } catch (PrinterException pe) {
        notifyEvent(PrintJobEvent.JOB_FAILED);
        throw new PrintException(pe);
    } finally {
        printReturned = true;
    }
}
项目:openjdk-jdk10    文件:UnixPrintJob.java   
public void pageableJob(Pageable pageable) throws PrintException {
    try {
        synchronized(this) {
            if (job != null) { // shouldn't happen
                throw new PrintException("already printing");
            } else {
                job = new PSPrinterJob();
            }
        }
        job.setPrintService(getPrintService());
        job.setCopies(copies);
        job.setJobName(jobName);
        job.setPageable(pageable);
        job.print(reqAttrSet);
        notifyEvent(PrintJobEvent.DATA_TRANSFER_COMPLETE);
        return;
    } catch (PrinterException pe) {
        notifyEvent(PrintJobEvent.JOB_FAILED);
        throw new PrintException(pe);
    } finally {
        printReturned = true;
        notifyEvent(PrintJobEvent.NO_MORE_EVENTS);
    }
}
项目:openjdk-jdk10    文件:UnixPrintJob.java   
public OutputStream run() {
    try {
        if (mDestType == UnixPrintJob.DESTFILE) {
            spoolFile = new File(mDestination);
        } else {
            /* Write to a temporary file which will be spooled to
             * the printer then deleted. In the case that the file
             * is not removed for some reason, request that it is
             * removed when the VM exits.
             */
            spoolFile = Files.createTempFile("javaprint", "").toFile();
            spoolFile.deleteOnExit();
        }
        result = new FileOutputStream(spoolFile);
        return result;
    } catch (IOException ex) {
        // If there is an IOError we subvert it to a PrinterException.
        notifyEvent(PrintJobEvent.JOB_FAILED);
        pex = new PrintException(ex);
    }
    return null;
}
项目:openjdk9    文件:PSStreamPrintJob.java   
public void pageableJob(Pageable pageable,
                        PrintRequestAttributeSet attributes)
    throws PrintException {
    try {
        synchronized(this) {
            if (job != null) { // shouldn't happen
                throw new PrintException("already printing");
            } else {
                job = new PSPrinterJob();
            }
        }
        job.setPrintService(getPrintService());
        job.setPageable(pageable);
        job.print(attributes);
        notifyEvent(PrintJobEvent.JOB_COMPLETE);
        return;
    } catch (PrinterException pe) {
        notifyEvent(PrintJobEvent.JOB_FAILED);
        throw new PrintException(pe);
    } finally {
        printReturned = true;
    }
}
项目:openjdk9    文件:UnixPrintJob.java   
public void pageableJob(Pageable pageable) throws PrintException {
    try {
        synchronized(this) {
            if (job != null) { // shouldn't happen
                throw new PrintException("already printing");
            } else {
                job = new PSPrinterJob();
            }
        }
        job.setPrintService(getPrintService());
        job.setCopies(copies);
        job.setJobName(jobName);
        job.setPageable(pageable);
        job.print(reqAttrSet);
        notifyEvent(PrintJobEvent.DATA_TRANSFER_COMPLETE);
        return;
    } catch (PrinterException pe) {
        notifyEvent(PrintJobEvent.JOB_FAILED);
        throw new PrintException(pe);
    } finally {
        printReturned = true;
        notifyEvent(PrintJobEvent.NO_MORE_EVENTS);
    }
}
项目:openjdk9    文件:UnixPrintJob.java   
public OutputStream run() {
    try {
        if (mDestType == UnixPrintJob.DESTFILE) {
            spoolFile = new File(mDestination);
        } else {
            /* Write to a temporary file which will be spooled to
             * the printer then deleted. In the case that the file
             * is not removed for some reason, request that it is
             * removed when the VM exits.
             */
            spoolFile = Files.createTempFile("javaprint", "").toFile();
            spoolFile.deleteOnExit();
        }
        result = new FileOutputStream(spoolFile);
        return result;
    } catch (IOException ex) {
        // If there is an IOError we subvert it to a PrinterException.
        notifyEvent(PrintJobEvent.JOB_FAILED);
        pex = new PrintException(ex);
    }
    return null;
}
项目:jdk8u_jdk    文件:PSStreamPrintJob.java   
public void pageableJob(Pageable pageable,
                        PrintRequestAttributeSet attributes)
    throws PrintException {
    try {
        synchronized(this) {
            if (job != null) { // shouldn't happen
                throw new PrintException("already printing");
            } else {
                job = new PSPrinterJob();
            }
        }
        job.setPrintService(getPrintService());
        job.setPageable(pageable);
        job.print(attributes);
        notifyEvent(PrintJobEvent.JOB_COMPLETE);
        return;
    } catch (PrinterException pe) {
        notifyEvent(PrintJobEvent.JOB_FAILED);
        throw new PrintException(pe);
    } finally {
        printReturned = true;
    }
}
项目:jdk8u_jdk    文件:UnixPrintJob.java   
public void pageableJob(Pageable pageable) throws PrintException {
    try {
        synchronized(this) {
            if (job != null) { // shouldn't happen
                throw new PrintException("already printing");
            } else {
                job = new PSPrinterJob();
            }
        }
        job.setPrintService(getPrintService());
        job.setCopies(copies);
        job.setJobName(jobName);
        job.setPageable(pageable);
        job.print(reqAttrSet);
        notifyEvent(PrintJobEvent.DATA_TRANSFER_COMPLETE);
        return;
    } catch (PrinterException pe) {
        notifyEvent(PrintJobEvent.JOB_FAILED);
        throw new PrintException(pe);
    } finally {
        printReturned = true;
        notifyEvent(PrintJobEvent.NO_MORE_EVENTS);
    }
}
项目:jdk8u_jdk    文件:UnixPrintJob.java   
public Object run() {
    try {
        if (mDestType == UnixPrintJob.DESTFILE) {
            spoolFile = new File(mDestination);
        } else {
            /* Write to a temporary file which will be spooled to
             * the printer then deleted. In the case that the file
             * is not removed for some reason, request that it is
             * removed when the VM exits.
             */
            spoolFile = Files.createTempFile("javaprint", "").toFile();
            spoolFile.deleteOnExit();
        }
        result = new FileOutputStream(spoolFile);
        return result;
    } catch (IOException ex) {
        // If there is an IOError we subvert it to a PrinterException.
        notifyEvent(PrintJobEvent.JOB_FAILED);
        pex = new PrintException(ex);
    }
    return null;
}
项目:lookaside_java-1.8.0-openjdk    文件:PSStreamPrintJob.java   
public void pageableJob(Pageable pageable,
                        PrintRequestAttributeSet attributes)
    throws PrintException {
    try {
        synchronized(this) {
            if (job != null) { // shouldn't happen
                throw new PrintException("already printing");
            } else {
                job = new PSPrinterJob();
            }
        }
        job.setPrintService(getPrintService());
        job.setPageable(pageable);
        job.print(attributes);
        notifyEvent(PrintJobEvent.JOB_COMPLETE);
        return;
    } catch (PrinterException pe) {
        notifyEvent(PrintJobEvent.JOB_FAILED);
        throw new PrintException(pe);
    } finally {
        printReturned = true;
    }
}
项目:lookaside_java-1.8.0-openjdk    文件:UnixPrintJob.java   
public void pageableJob(Pageable pageable) throws PrintException {
    try {
        synchronized(this) {
            if (job != null) { // shouldn't happen
                throw new PrintException("already printing");
            } else {
                job = new PSPrinterJob();
            }
        }
        job.setPrintService(getPrintService());
        job.setCopies(copies);
        job.setJobName(jobName);
        job.setPageable(pageable);
        job.print(reqAttrSet);
        notifyEvent(PrintJobEvent.DATA_TRANSFER_COMPLETE);
        return;
    } catch (PrinterException pe) {
        notifyEvent(PrintJobEvent.JOB_FAILED);
        throw new PrintException(pe);
    } finally {
        printReturned = true;
        notifyEvent(PrintJobEvent.NO_MORE_EVENTS);
    }
}
项目:lookaside_java-1.8.0-openjdk    文件:UnixPrintJob.java   
public Object run() {
    try {
        if (mDestType == UnixPrintJob.DESTFILE) {
            spoolFile = new File(mDestination);
        } else {
            /* Write to a temporary file which will be spooled to
             * the printer then deleted. In the case that the file
             * is not removed for some reason, request that it is
             * removed when the VM exits.
             */
            spoolFile = Files.createTempFile("javaprint", "").toFile();
            spoolFile.deleteOnExit();
        }
        result = new FileOutputStream(spoolFile);
        return result;
    } catch (IOException ex) {
        // If there is an IOError we subvert it to a PrinterException.
        notifyEvent(PrintJobEvent.JOB_FAILED);
        pex = new PrintException(ex);
    }
    return null;
}
项目:jvm-stm    文件:DocPrintJobImpl.java   
private void notifyPrintJobListeners(PrintJobEvent e)
{
  Iterator it = printJobListener.iterator();
  while (it.hasNext())
    {
      PrintJobListener l = (PrintJobListener) it.next();
      if (e.getPrintEventType() == PrintJobEvent.DATA_TRANSFER_COMPLETE)
        l.printDataTransferCompleted(e);
      else if (e.getPrintEventType() == PrintJobEvent.JOB_CANCELED)
        l.printJobCanceled(e);
      else if (e.getPrintEventType() == PrintJobEvent.JOB_COMPLETE)
        l.printJobCompleted(e);
      else if (e.getPrintEventType() == PrintJobEvent.JOB_FAILED)
        l.printJobFailed(e);
      else if (e.getPrintEventType() == PrintJobEvent.NO_MORE_EVENTS)
        l.printJobNoMoreEvents(e);
      else 
        l.printJobRequiresAttention(e);
    }    
}
项目:infobip-open-jdk-8    文件:PSStreamPrintJob.java   
public void pageableJob(Pageable pageable,
                        PrintRequestAttributeSet attributes)
    throws PrintException {
    try {
        synchronized(this) {
            if (job != null) { // shouldn't happen
                throw new PrintException("already printing");
            } else {
                job = new PSPrinterJob();
            }
        }
        job.setPrintService(getPrintService());
        job.setPageable(pageable);
        job.print(attributes);
        notifyEvent(PrintJobEvent.JOB_COMPLETE);
        return;
    } catch (PrinterException pe) {
        notifyEvent(PrintJobEvent.JOB_FAILED);
        throw new PrintException(pe);
    } finally {
        printReturned = true;
    }
}
项目:infobip-open-jdk-8    文件:UnixPrintJob.java   
public void pageableJob(Pageable pageable) throws PrintException {
    try {
        synchronized(this) {
            if (job != null) { // shouldn't happen
                throw new PrintException("already printing");
            } else {
                job = new PSPrinterJob();
            }
        }
        job.setPrintService(getPrintService());
        job.setCopies(copies);
        job.setJobName(jobName);
        job.setPageable(pageable);
        job.print(reqAttrSet);
        notifyEvent(PrintJobEvent.DATA_TRANSFER_COMPLETE);
        return;
    } catch (PrinterException pe) {
        notifyEvent(PrintJobEvent.JOB_FAILED);
        throw new PrintException(pe);
    } finally {
        printReturned = true;
        notifyEvent(PrintJobEvent.NO_MORE_EVENTS);
    }
}
项目:infobip-open-jdk-8    文件:UnixPrintJob.java   
public Object run() {
    try {
        if (mDestType == UnixPrintJob.DESTFILE) {
            spoolFile = new File(mDestination);
        } else {
            /* Write to a temporary file which will be spooled to
             * the printer then deleted. In the case that the file
             * is not removed for some reason, request that it is
             * removed when the VM exits.
             */
            spoolFile = Files.createTempFile("javaprint", "").toFile();
            spoolFile.deleteOnExit();
        }
        result = new FileOutputStream(spoolFile);
        return result;
    } catch (IOException ex) {
        // If there is an IOError we subvert it to a PrinterException.
        notifyEvent(PrintJobEvent.JOB_FAILED);
        pex = new PrintException(ex);
    }
    return null;
}
项目:jdk8u-dev-jdk    文件:PSStreamPrintJob.java   
public void pageableJob(Pageable pageable,
                        PrintRequestAttributeSet attributes)
    throws PrintException {
    try {
        synchronized(this) {
            if (job != null) { // shouldn't happen
                throw new PrintException("already printing");
            } else {
                job = new PSPrinterJob();
            }
        }
        job.setPrintService(getPrintService());
        job.setPageable(pageable);
        job.print(attributes);
        notifyEvent(PrintJobEvent.JOB_COMPLETE);
        return;
    } catch (PrinterException pe) {
        notifyEvent(PrintJobEvent.JOB_FAILED);
        throw new PrintException(pe);
    } finally {
        printReturned = true;
    }
}
项目:jdk8u-dev-jdk    文件:UnixPrintJob.java   
public void pageableJob(Pageable pageable) throws PrintException {
    try {
        synchronized(this) {
            if (job != null) { // shouldn't happen
                throw new PrintException("already printing");
            } else {
                job = new PSPrinterJob();
            }
        }
        job.setPrintService(getPrintService());
        job.setCopies(copies);
        job.setJobName(jobName);
        job.setPageable(pageable);
        job.print(reqAttrSet);
        notifyEvent(PrintJobEvent.DATA_TRANSFER_COMPLETE);
        return;
    } catch (PrinterException pe) {
        notifyEvent(PrintJobEvent.JOB_FAILED);
        throw new PrintException(pe);
    } finally {
        printReturned = true;
        notifyEvent(PrintJobEvent.NO_MORE_EVENTS);
    }
}
项目:jdk8u-dev-jdk    文件:UnixPrintJob.java   
public Object run() {
    try {
        if (mDestType == UnixPrintJob.DESTFILE) {
            spoolFile = new File(mDestination);
        } else {
            /* Write to a temporary file which will be spooled to
             * the printer then deleted. In the case that the file
             * is not removed for some reason, request that it is
             * removed when the VM exits.
             */
            spoolFile = Files.createTempFile("javaprint", "").toFile();
            spoolFile.deleteOnExit();
        }
        result = new FileOutputStream(spoolFile);
        return result;
    } catch (IOException ex) {
        // If there is an IOError we subvert it to a PrinterException.
        notifyEvent(PrintJobEvent.JOB_FAILED);
        pex = new PrintException(ex);
    }
    return null;
}
项目:jdk7-jdk    文件:PSStreamPrintJob.java   
public void pageableJob(Pageable pageable,
                        PrintRequestAttributeSet attributes)
    throws PrintException {
    try {
        synchronized(this) {
            if (job != null) { // shouldn't happen
                throw new PrintException("already printing");
            } else {
                job = new PSPrinterJob();
            }
        }
        job.setPrintService(getPrintService());
        job.setPageable(pageable);
        job.print(attributes);
        notifyEvent(PrintJobEvent.JOB_COMPLETE);
        return;
    } catch (PrinterException pe) {
        notifyEvent(PrintJobEvent.JOB_FAILED);
        throw new PrintException(pe);
    } finally {
        printReturned = true;
    }
}
项目:jdk7-jdk    文件:UnixPrintJob.java   
public void pageableJob(Pageable pageable) throws PrintException {
    try {
        synchronized(this) {
            if (job != null) { // shouldn't happen
                throw new PrintException("already printing");
            } else {
                job = new PSPrinterJob();
            }
        }
        job.setPrintService(getPrintService());
        job.setCopies(copies);
        job.setJobName(jobName);
        job.setPageable(pageable);
        job.print(reqAttrSet);
        notifyEvent(PrintJobEvent.DATA_TRANSFER_COMPLETE);
        return;
    } catch (PrinterException pe) {
        notifyEvent(PrintJobEvent.JOB_FAILED);
        throw new PrintException(pe);
    } finally {
        printReturned = true;
        notifyEvent(PrintJobEvent.NO_MORE_EVENTS);
    }
}
项目:jdk7-jdk    文件:UnixPrintJob.java   
public Object run() {
    try {
        if (mDestType == UnixPrintJob.DESTFILE) {
            spoolFile = new File(mDestination);
        } else {
            /* Write to a temporary file which will be spooled to
             * the printer then deleted. In the case that the file
             * is not removed for some reason, request that it is
             * removed when the VM exits.
             */
            spoolFile = File.createTempFile("javaprint", ".ps", null);
            spoolFile.deleteOnExit();
        }
        result = new FileOutputStream(spoolFile);
        return result;
    } catch (IOException ex) {
        // If there is an IOError we subvert it to a PrinterException.
        notifyEvent(PrintJobEvent.JOB_FAILED);
        pex = new PrintException(ex);
    }
    return null;
}
项目:openjdk-source-code-learn    文件:PSStreamPrintJob.java   
public void pageableJob(Pageable pageable,
                        PrintRequestAttributeSet attributes)
    throws PrintException {
    try {
        synchronized(this) {
            if (job != null) { // shouldn't happen
                throw new PrintException("already printing");
            } else {
                job = new PSPrinterJob();
            }
        }
        job.setPrintService(getPrintService());
        job.setPageable(pageable);
        job.print(attributes);
        notifyEvent(PrintJobEvent.JOB_COMPLETE);
        return;
    } catch (PrinterException pe) {
        notifyEvent(PrintJobEvent.JOB_FAILED);
        throw new PrintException(pe);
    } finally {
        printReturned = true;
    }
}
项目:openjdk-source-code-learn    文件:UnixPrintJob.java   
public void pageableJob(Pageable pageable) throws PrintException {
    try {
        synchronized(this) {
            if (job != null) { // shouldn't happen
                throw new PrintException("already printing");
            } else {
                job = new PSPrinterJob();
            }
        }
        job.setPrintService(getPrintService());
        job.setCopies(copies);
        job.setJobName(jobName);
        job.setPageable(pageable);
        job.print(reqAttrSet);
        notifyEvent(PrintJobEvent.DATA_TRANSFER_COMPLETE);
        return;
    } catch (PrinterException pe) {
        notifyEvent(PrintJobEvent.JOB_FAILED);
        throw new PrintException(pe);
    } finally {
        printReturned = true;
        notifyEvent(PrintJobEvent.NO_MORE_EVENTS);
    }
}
项目:openjdk-source-code-learn    文件:UnixPrintJob.java   
public Object run() {
    try {
        if (mDestType == UnixPrintJob.DESTFILE) {
            spoolFile = new File(mDestination);
        } else {
            /* Write to a temporary file which will be spooled to
             * the printer then deleted. In the case that the file
             * is not removed for some reason, request that it is
             * removed when the VM exits.
             */
            spoolFile = File.createTempFile("javaprint", ".ps", null);
            spoolFile.deleteOnExit();
        }
        result = new FileOutputStream(spoolFile);
        return result;
    } catch (IOException ex) {
        // If there is an IOError we subvert it to a PrinterException.
        notifyEvent(PrintJobEvent.JOB_FAILED);
        pex = new PrintException(ex);
    }
    return null;
}
项目:OLD-OpenJDK8    文件:PSStreamPrintJob.java   
public void pageableJob(Pageable pageable,
                        PrintRequestAttributeSet attributes)
    throws PrintException {
    try {
        synchronized(this) {
            if (job != null) { // shouldn't happen
                throw new PrintException("already printing");
            } else {
                job = new PSPrinterJob();
            }
        }
        job.setPrintService(getPrintService());
        job.setPageable(pageable);
        job.print(attributes);
        notifyEvent(PrintJobEvent.JOB_COMPLETE);
        return;
    } catch (PrinterException pe) {
        notifyEvent(PrintJobEvent.JOB_FAILED);
        throw new PrintException(pe);
    } finally {
        printReturned = true;
    }
}
项目:OLD-OpenJDK8    文件:UnixPrintJob.java   
public void pageableJob(Pageable pageable) throws PrintException {
    try {
        synchronized(this) {
            if (job != null) { // shouldn't happen
                throw new PrintException("already printing");
            } else {
                job = new PSPrinterJob();
            }
        }
        job.setPrintService(getPrintService());
        job.setCopies(copies);
        job.setJobName(jobName);
        job.setPageable(pageable);
        job.print(reqAttrSet);
        notifyEvent(PrintJobEvent.DATA_TRANSFER_COMPLETE);
        return;
    } catch (PrinterException pe) {
        notifyEvent(PrintJobEvent.JOB_FAILED);
        throw new PrintException(pe);
    } finally {
        printReturned = true;
        notifyEvent(PrintJobEvent.NO_MORE_EVENTS);
    }
}
项目:OLD-OpenJDK8    文件:UnixPrintJob.java   
public Object run() {
    try {
        if (mDestType == UnixPrintJob.DESTFILE) {
            spoolFile = new File(mDestination);
        } else {
            /* Write to a temporary file which will be spooled to
             * the printer then deleted. In the case that the file
             * is not removed for some reason, request that it is
             * removed when the VM exits.
             */
            spoolFile = Files.createTempFile("javaprint", "").toFile();
            spoolFile.deleteOnExit();
        }
        result = new FileOutputStream(spoolFile);
        return result;
    } catch (IOException ex) {
        // If there is an IOError we subvert it to a PrinterException.
        notifyEvent(PrintJobEvent.JOB_FAILED);
        pex = new PrintException(ex);
    }
    return null;
}
项目:cn1    文件:WinPrintJob.java   
void notifyJobListeners(final int reason) {
    final PrintJobEvent event = new PrintJobEvent(this, reason);

    for (PrintJobListener listener : jobListeners.keySet()) {
        switch (reason) {
        case PrintJobEvent.DATA_TRANSFER_COMPLETE:
            listener.printDataTransferCompleted(event);
            break;
        case PrintJobEvent.JOB_CANCELED:
            listener.printJobCanceled(event);
            break;
        case PrintJobEvent.JOB_COMPLETE:
            listener.printJobCompleted(event);
            break;
        case PrintJobEvent.JOB_FAILED:
            listener.printJobFailed(event);
            break;
        case PrintJobEvent.NO_MORE_EVENTS:
            listener.printJobNoMoreEvents(event);
            break;
        case PrintJobEvent.REQUIRES_ATTENTION:
            listener.printJobRequiresAttention(event);
            break;
        }
    }
}
项目:JamVM-PH    文件:DocPrintJobImpl.java   
private void notifyPrintJobListeners(PrintJobEvent e)
{
  Iterator it = printJobListener.iterator();
  while (it.hasNext())
    {
      PrintJobListener l = (PrintJobListener) it.next();
      if (e.getPrintEventType() == PrintJobEvent.DATA_TRANSFER_COMPLETE)
        l.printDataTransferCompleted(e);
      else if (e.getPrintEventType() == PrintJobEvent.JOB_CANCELED)
        l.printJobCanceled(e);
      else if (e.getPrintEventType() == PrintJobEvent.JOB_COMPLETE)
        l.printJobCompleted(e);
      else if (e.getPrintEventType() == PrintJobEvent.JOB_FAILED)
        l.printJobFailed(e);
      else if (e.getPrintEventType() == PrintJobEvent.NO_MORE_EVENTS)
        l.printJobNoMoreEvents(e);
      else 
        l.printJobRequiresAttention(e);
    }    
}
项目:openjdk-jdk7u-jdk    文件:PSStreamPrintJob.java   
public void pageableJob(Pageable pageable,
                        PrintRequestAttributeSet attributes)
    throws PrintException {
    try {
        synchronized(this) {
            if (job != null) { // shouldn't happen
                throw new PrintException("already printing");
            } else {
                job = new PSPrinterJob();
            }
        }
        job.setPrintService(getPrintService());
        job.setPageable(pageable);
        job.print(attributes);
        notifyEvent(PrintJobEvent.JOB_COMPLETE);
        return;
    } catch (PrinterException pe) {
        notifyEvent(PrintJobEvent.JOB_FAILED);
        throw new PrintException(pe);
    } finally {
        printReturned = true;
    }
}
项目:openjdk-jdk7u-jdk    文件:UnixPrintJob.java   
public void pageableJob(Pageable pageable) throws PrintException {
    try {
        synchronized(this) {
            if (job != null) { // shouldn't happen
                throw new PrintException("already printing");
            } else {
                job = new PSPrinterJob();
            }
        }
        job.setPrintService(getPrintService());
        job.setCopies(copies);
        job.setJobName(jobName);
        job.setPageable(pageable);
        job.print(reqAttrSet);
        notifyEvent(PrintJobEvent.DATA_TRANSFER_COMPLETE);
        return;
    } catch (PrinterException pe) {
        notifyEvent(PrintJobEvent.JOB_FAILED);
        throw new PrintException(pe);
    } finally {
        printReturned = true;
        notifyEvent(PrintJobEvent.NO_MORE_EVENTS);
    }
}
项目:openjdk-jdk7u-jdk    文件:UnixPrintJob.java   
public Object run() {
    try {
        if (mDestType == UnixPrintJob.DESTFILE) {
            spoolFile = new File(mDestination);
        } else {
            /* Write to a temporary file which will be spooled to
             * the printer then deleted. In the case that the file
             * is not removed for some reason, request that it is
             * removed when the VM exits.
             */
            spoolFile = Files.createTempFile("javaprint", "").toFile();
            spoolFile.deleteOnExit();
        }
        result = new FileOutputStream(spoolFile);
        return result;
    } catch (IOException ex) {
        // If there is an IOError we subvert it to a PrinterException.
        notifyEvent(PrintJobEvent.JOB_FAILED);
        pex = new PrintException(ex);
    }
    return null;
}